all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: tabulated-list-mode: how to activate button?
Date: Mon, 07 Dec 2020 03:36:54 +0300	[thread overview]
Message-ID: <courier.000000005FCD7929.00004727@static.rcdrun.com> (raw)

I have reported this as bug, but maybe somebody has solution as I need
help to extend Hyperscope dynamic knowledge repository.

Here I am defining new `my-mode' child of `tabulated-list-mode'

(define-derived-mode my-mode tabulated-list-mode "Choice" "Choice Mode"
  (setq tabulated-list-padding 1)
  (setq tabulated-list-format  [("Title" 60 t) ("Button" 20 t)])
  (tabulated-list-init-header))

Then I wish to create a button as described in
{C-h v tabulated-list-entries RET}

Documentation:
Entries displayed in the current Tabulated List buffer.
This should be either a function, or a list.
If a list, each element has the form (ID [DESC1 ... DESCN]),
where:
 - ID is nil, or a Lisp object uniquely identifying this entry,
   which is used to keep the cursor on the "same" entry when
   rearranging the list.  Comparison is done with ‘equal’.

 - Each DESC is a column descriptor, one for each column
   specified in ‘tabulated-list-format’.  A descriptor is either
   a string, which is printed as-is, or a list (LABEL . PROPS),
   which means to use ‘insert-text-button’ to insert a text
   button with label LABEL and button properties PROPS.
   The string, or button label, must not contain any newline.

(defun my-display ()
  (let* ((buffer "Choice")
	 (buffer (get-buffer-create buffer)))
    (switch-to-buffer-other-window buffer)
    (my-mode)
    (setq tabulated-list-entries '((1 ["Something" ("Button" 'action (lambda (b) (message "Hello")) 'font-lock-face 'link 'follow-link t)])))
    (tabulated-list-print t)))
    
When activated this function shows the button, but I cannot activate
the button.

(my-display) ;; This will not activate the button as I cannot see "Hello"

;; while this works fine and I can see "Hello" when button is activated
(insert-text-button "Button" 'action (lambda (b) (message "Hello")))




             reply	other threads:[~2020-12-07  0:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  0:36 Jean Louis [this message]
2020-12-07  0:44 ` tabulated-list-mode: how to activate button? Michael Heerdegen
2020-12-07  0:55   ` Jean Louis
2020-12-07  1:07     ` Michael Heerdegen
2020-12-07  1:16       ` Jean Louis
2020-12-07  1:31         ` Michael Heerdegen
2020-12-07  5:44           ` [solved] " Jean Louis
2020-12-07  2:26         ` Drew Adams
2020-12-07  5:46           ` Jean Louis

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=courier.000000005FCD7929.00004727@static.rcdrun.com \
    --to=bugs@gnu.support \
    --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.