[Top][All Lists]

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

how to set button action

From: Stefan Huchler
Subject: how to set button action
Date: Sun, 16 Oct 2016 04:36:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)


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"))))])))

(defun test-foo ()
  (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
             (kill-buffer buffer)
             (signal (car e) (cdr e))))))
      (switch-to-buffer-other-window buffer))))

reply via email to

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