help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to set button action


From: Alex Kost
Subject: Re: how to set button action
Date: Sun, 16 Oct 2016 16:43:40 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]