unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Iinteractive function allowing multiple inputs
Date: Tue, 10 Dec 2024 00:11:37 +0300	[thread overview]
Message-ID: <Z1ddCZZ3ooqv3pFy@lco2> (raw)
In-Reply-To: <i0E7lw8XA2Ua4neV_o7LgMic7CVHKqDOFY_3VWDozIoR2U_4-cfUmGgy6fgNSZeFSisdULPA5c5-uytfBG9CweHCOQD1pjYsPzbjUT7qPHg=@protonmail.com>

* Heime <heimeborgia@protonmail.com> [2024-12-10 00:02]:
> Have found completing-read-multiple.  But need some help understanding 
> the exact format.  I want to set company-backends.  How would one pass
> the multiple arguments in elisp code?  

It is not easy to understand how you mean it.

- you could simply define function with multiple arguments

- you can pass single argument which has many items, like you could pass list, plist or alist or hash

(setq my-hash (make-hash-table :test 'equal))
(puthash "Name" "Heime" my-hash)
(puthash "Age" 37 my-hash)
(puthash "Skills" '(Programmer Scientist) my-hash)

(defun my-fun (hash)
  (let ((name (gethash "Name" hash))
	(age (gethash "Age" hash))
	(skills (gethash "Skills" hash)))
    (format "Your name is %s, your age %s and your skills are: %s" name age skills)))

(my-fun my-hash) ➜ "Your name is Heime, your age 37 and your skills are: (Programmer Scientist)"

That way you are passing `hash' as single argument which may have unlimited other arguments indirectly..

-- 
Jean Louis



  reply	other threads:[~2024-12-09 21:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 18:40 Iinteractive function allowing multiple inputs Heime via Users list for the GNU Emacs text editor
2024-12-09 20:43 ` Jean Louis
2024-12-09 20:48   ` Heime via Users list for the GNU Emacs text editor
2024-12-09 21:02     ` Heime via Users list for the GNU Emacs text editor
2024-12-09 21:11       ` Jean Louis [this message]
2024-12-09 21:06     ` Jean Louis
2024-12-09 21:14       ` Heime via Users list for the GNU Emacs text editor
2024-12-09 21:20         ` Jean Louis
2024-12-09 21:42           ` Heime via Users list for the GNU Emacs text editor
2024-12-09 21:46             ` Heime via Users list for the GNU Emacs text editor
2024-12-09 23:05               ` Jean Louis
2024-12-09 23:47                 ` Heime via Users list for the GNU Emacs text editor
2024-12-10  7:12                   ` Jean Louis
2024-12-09 21:23   ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-09 23:08     ` Jean Louis
2024-12-09 23:39       ` Heime via Users list for the GNU Emacs text editor

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=Z1ddCZZ3ooqv3pFy@lco2 \
    --to=bugs@gnu.support \
    --cc=heimeborgia@protonmail.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).