unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Alessandro Bertulli <alessandro.bertulli96@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Elisp: can't read buffer content with with-current-buffer
Date: Fri, 03 Jun 2022 08:25:57 +0200	[thread overview]
Message-ID: <87a6auuuob.fsf@gnu.org> (raw)
In-Reply-To: <CAJczNmA89XLnPoZSh=xux0qu9v89UvRwKDh4UfGN4SmuS19Nkg@mail.gmail.com>

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	other threads:[~2022-06-03  6:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 16:45 Elisp: can't read buffer content with with-current-buffer Alessandro Bertulli
2022-06-02 20:33 ` Tassilo Horn
2022-06-02 22:48   ` Alessandro Bertulli
2022-06-03  6:25     ` Tassilo Horn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6auuuob.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=alessandro.bertulli96@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).