]> git.notmuchmail.org Git - notmuch/commitdiff
contrib: pick: add button press helper
authorMark Walters <markwalters1009@gmail.com>
Thu, 22 Aug 2013 17:10:21 +0000 (18:10 +0100)
committerDavid Bremner <bremner@debian.org>
Sat, 24 Aug 2013 09:17:16 +0000 (11:17 +0200)
We will want to be able to activate buttons not in the current
buffer (ie in the message pane) so it is helpful to have a way of
activating a button without signalling error if there is no button.

contrib/notmuch-pick/notmuch-pick.el

index 9c1864b2c115f7b7750ea2f9fcfb16195489017e..f24f2b311af1d6f3c3fc1db1ad9f7da98d8e06e3 100644 (file)
@@ -200,6 +200,14 @@ open (if the message pane is closed it does nothing)."
        (with-selected-window notmuch-pick-message-window
         (call-interactively #',func)))))
 
+(defun notmuch-pick-button-activate (&optional button)
+  "Activate BUTTON or button at point
+
+This function does not give an error if there is no button."
+  (interactive)
+  (let ((button (or button (button-at (point)))))
+    (when button (button-activate button))))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)