From: Alex Kost <alezost@gmail.com>
To: Stefan Huchler <stefan.huchler@mail.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: how to set button action
Date: Sun, 16 Oct 2016 16:43:40 +0300 [thread overview]
Message-ID: <87oa2kpfxv.fsf@gmail.com> (raw)
In-Reply-To: <87r37hkojz.fsf@jupiter.lan> (Stefan Huchler's message of "Sun, 16 Oct 2016 04:36:32 +0200")
Stefan Huchler (2016-10-16 04:36 +0200) wrote:
> Hi,
>
> I am trying to get buttons working in a tabulated-list mode but when I
> press enter on that link it does not execute the print.
>
> also tried it without lambda and the funcions name. Is there a trick I
> am missing?
>
>
> (define-derived-mode test-foo-mode tabulated-list-mode "test-foo"
> (setq tabulated-list-format [("Series" 10 t)])
> (setq tabulated-list-entries '((nil [("test" . ('action (lambda (btn)
> (print "action"))))])))
The foollowing works for me:
(setq tabulated-list-entries
'((nil [("test" action (lambda (btn) (print "action")))])))
> (tabulated-list-init-header)
> (tabulated-list-print)
> )
>
> (defun test-foo ()
> (interactive)
> (let* ((name "*test-foo*")
> (buffer (or (get-buffer name)
> (generate-new-buffer name))))
> (unless (eq buffer (current-buffer))
> (with-current-buffer buffer
> (unless (eq major-mode 'test-foo-mode)
> (condition-case e
> (progn
> (test-foo-mode)
> )
> (error
> (kill-buffer buffer)
> (signal (car e) (cdr e))))))
> (switch-to-buffer-other-window buffer))))
--
Alex
next prev parent reply other threads:[~2016-10-16 13:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 2:36 how to set button action Stefan Huchler
2016-10-16 13:43 ` Alex Kost [this message]
2016-10-18 5:45 ` Stefan Huchler
2016-10-19 10:03 ` Michael Heerdegen
2016-10-20 2:57 ` Stefan Huchler
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oa2kpfxv.fsf@gmail.com \
--to=alezost@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=stefan.huchler@mail.de \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).