help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp: can't read buffer content with with-current-buffer


From: Tassilo Horn
Subject: Re: Elisp: can't read buffer content with with-current-buffer
Date: Fri, 03 Jun 2022 08:25:57 +0200
User-agent: mu4e 1.7.26; emacs 29.0.50

Alessandro Bertulli <alessandro.bertulli96@gmail.com> writes:

Hi Alessandro,

> Thanks Tassilo, it now works!

Great.

> However, now I have a next problem. I have this function for debug:
>
> (defun run-java-main-method (mainClass)
>
>   (interactive
>    (completing-read "Run main method: " (get-main-method-list)))
>    (message "Read %s" mainClass)
>   )
>
> So that it simply echoes the entered text. Minibuffer completion works
> fine (I use Vertico), but when pressing RET I got this error (I report
> the debugger output, got by setting debug-on-error to t):
>
> Debugger entered--Lisp error: (wrong-type-argument listp
> "/home/alessandro/akka/src/main/java/com/example/Ak...")
>   call-interactively(run-java-main-method nil nil)
>   command-execute(run-java-main-method)
>
> I don't get it. Where is it expecting a list?

A function receives a list of arguments and `interactive' is supposed to
get a list (or a string which is interpreted according its spec).  So
this should do:

(defun run-java-main-method (mainClass)
  (interactive
   (list (completing-read "Run main method: " (get-main-method-list))))
  (message "Read %s" mainClass))

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]