From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: tabulated-list-mode: how to activate button? Date: Mon, 07 Dec 2020 03:36:54 +0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2597"; mail-complaints-to="usenet@ciao.gmane.io" To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 07 01:38:03 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1km4XS-0000dU-VO for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Dec 2020 01:38:02 +0100 Original-Received: from localhost ([::1]:40344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1km4XS-0006uu-02 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 06 Dec 2020 19:38:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1km4Wh-0006jM-D8 for help-gnu-emacs@gnu.org; Sun, 06 Dec 2020 19:37:15 -0500 Original-Received: from static.rcdrun.com ([95.85.24.50]:48635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1km4WR-0000gP-MP for help-gnu-emacs@gnu.org; Sun, 06 Dec 2020 19:37:14 -0500 Original-Received: from localhost ([::ffff:197.157.0.57]) (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by static.rcdrun.com with ESMTPSA id 00000000002C0007.000000005FCD7929.00004727; Mon, 07 Dec 2020 00:36:57 +0000 Received-SPF: pass client-ip=95.85.24.50; envelope-from=support1@rcdrun.com; helo=static.rcdrun.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, HDRS_LCASE=0.099, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126127 Archived-At: 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")))