all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Functions behaving according to button presses
@ 2023-08-28 18:11 Heime
  2023-08-29  7:04 ` Jean Louis
  0 siblings, 1 reply; 2+ messages in thread
From: Heime @ 2023-08-28 18:11 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


Have noticed that I can have a function like this, which I can
use with elisp code, using for example 

 (insert-button "[Next]" 'action 'action-snapshot 'follow-link t)

The above will also work with any button property name like "[Next]".
Alternatively I can execute only the "[B5]" part using

(insert-button "[B5]" 'action 'action-snapshot 'follow-link t)

Or call it interactively with 'M-x action-snapshot'.  In such case,
the function would execute '(insert "that")'.

(defun action-snapshot (&optional button)

  (pcase (button-label button)
    ("[B5]"
        (insert "this"))
    (_ 
        (insert "that"))))

Is the aforementioned description correct.  Is there anything else, alternative
ways of using function that react according to button clicks ?







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-29  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 18:11 Functions behaving according to button presses Heime
2023-08-29  7:04 ` Jean Louis

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.