all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Calling function associated with a button
Date: Mon, 08 Jul 2024 21:14:57 +0000	[thread overview]
Message-ID: <LBG7-V7h1y7mrnPstvxOReDltrR5zT83jIHD9tEKhwoKtwr0-OpJ0aiizT1T211JfNjua-3PPS9tYfBs4BUcf6aiuDCanXZ0BhNScfeerrI=@protonmail.com> (raw)

I want to have a set of buttons and labels (placed into three columns) that 
execute particular functions when the buttons are pressed.  

Things have been going well, except when I try making moped call the appropriate
entry in the functions lists (fc1-list, fc2-list, fc3s-list) for each button.

(defun moped (monbf fc1-list fc2-list fc3s-list lb1-list lb2-list lb3-list)
  "Insert three lists of labels into BUFFER-NAME in three columns."

  (with-current-buffer (get-buffer-create monbf)

    (erase-buffer)  ; Clear the buffer before inserting new labels
    (insert "\n")

    (let* ( (max-rows
              (max (length lb1-list) (length lb2-list) (length lb2-list)))
            (spx " ")          ; Space following button
            (kwd 13)           ; Column Width
            (zwd (+ kwd 4)) )  ; Empty Column Width

      (dotimes (i max-rows)

        (insert spx)

        ;;--------------------------------------------------------

        (let ((lbv1 (nth i lb1-list)))
          (if lbv1

              (progn
                (insert-button "[-]"
                  'action (lambda (b) (nth i fc1-list)))
                (insert (format (format "%%s%%-%ds" kwd) spx lbv1)))

            (insert (make-string zwd ?\s))))

        ;;--------------------------------------------------------

        (let ((lbv2 (nth i lb2-list)))
          (if lbv2

              (progn
                (insert-button "[-]"
                  'action (lambda (b) (nth i fc2-list)))
                (insert (format (format "%%s%%-%ds" kwd) spx lbv2)))

            (insert (make-string zwd ?\s))))

        ;;--------------------------------------------------------

        (let ((lbv3 (nth i lb3-list)))
          (if lbv3

              (progn
                (insert-button "[-]"
                  'action (lambda (b) (nth i fc3-list)))
                (insert (format (format "%%s%%-%ds" kwd) spx lbv3)))

            (insert (make-string zwd ?\s))))

        ;;--------------------------------------------------------

        (insert "\n"))))

    (pop-to-buffer monbf))




                 reply	other threads:[~2024-07-08 21:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='LBG7-V7h1y7mrnPstvxOReDltrR5zT83jIHD9tEKhwoKtwr0-OpJ0aiizT1T211JfNjua-3PPS9tYfBs4BUcf6aiuDCanXZ0BhNScfeerrI=@protonmail.com' \
    --to=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.