From: Stephen Berman <stephen.berman@gmx.net>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Make command use specific functions for button action
Date: Wed, 03 Jul 2024 00:04:49 +0200 [thread overview]
Message-ID: <87le2jzbzy.fsf@gmx.net> (raw)
In-Reply-To: <mfV-jYOubL4FzgbsS-Nm4sFbExjRyOxhQCWGsUBoQC_Q2uld7_mwhp61bhqXf7NmXTurRoGr5Guh5ziVzKacV1_j7OzCvTpiNRd8Gom55ks=@protonmail.com> (Heime's message of "Tue, 02 Jul 2024 19:54:18 +0000")
On Tue, 02 Jul 2024 19:54:18 +0000 Heime <heimeborgia@protonmail.com> wrote:
> I have this function that displays two buttons, and calls the
> corresponding functions lsk1g and lsk1d. I would really like to have
> the capability to instruct mondu to use specific function names
> rather than the hardwired lsk1g and lsk1d.
>
> For instance I want to make a call to mondu that will use lsk2g and
> lsk2d rather than lsk1g and lsk1d.
>
> (defun mondu ( monbf )
>
> (with-current-buffer (get-buffer-create monbf)
>
> (insert " DU \n\n")
>
> (insert " ")
> (insert-button "[-]" 'action 'lsk1g)
> (insert " lsk1g ")
>
> (insert-button "[-]" 'action 'lsk1d)
> (insert " lsk1d ") )
>
> (pop-to-buffer monbf) )
Pass a list of symbols of the functions you want on each invocation:
(defun mondu (monbf funs)
...
(let ((fun1 (nth 0 funs)))
(insert-button "[-]" 'action fun1)
(insert-button (concat " " (symbol-name fun1) " ")))
...)
(mondu "Mondu" '(lsk2g lsk2d))
Steve Berman
prev parent reply other threads:[~2024-07-02 22:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 19:54 Make command use specific functions for button action Heime
2024-07-02 22:04 ` Stephen Berman [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87le2jzbzy.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.