summaryrefslogtreecommitdiffhomepage
path: root/notmuch.org
diff options
context:
space:
mode:
Diffstat (limited to 'notmuch.org')
-rw-r--r--notmuch.org49
1 files changed, 24 insertions, 25 deletions
diff --git a/notmuch.org b/notmuch.org
index dd8d0d9..c12019a 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -398,9 +398,32 @@
#+end_src
* tree
#+begin_src emacs-lisp
+ (defun jao-notmuch-tree--forward (&optional prev)
+ (interactive)
+ (forward-line (if prev -1 1))
+ (when prev (forward-char 2))
+ (jao-notmuch-tree-scroll-or-next))
+
+ (defun jao-notmuch-tree--backward ()
+ (interactive)
+ (jao-notmuch-tree--forward t))
+
+ (defun jao-notmuch--via-url ()
+ (when (window-live-p notmuch-tree-message-window)
+ (with-selected-window notmuch-tree-message-window
+ (goto-char (point-min))
+ (when (re-search-forward "^Via: http" nil t)
+ (thing-at-point-url-at-point)))))
+
+ (defun jao-notmuch-browse-url (ext)
+ (interactive "P")
+ (when-let (url (or (jao-notmuch--via-url)
+ (car (last (jao-notmuch-message-urls)))))
+ (funcall (if ext browse-url-secondary-browser-function #'browse-url)
+ url)))
+
(use-package notmuch-tree
:init
-
(setq notmuch-tree-result-format
`(("date" . "%12s ")
("authors" . "%-35s")
@@ -428,30 +451,6 @@
(jao-notmuch-tree-setup "T")
- (defun jao-notmuch-tree--forward (&optional prev)
- (interactive)
- (forward-line (if prev -1 1))
- (when prev (forward-char 2))
- (jao-notmuch-tree-scroll-or-next))
-
- (defun jao-notmuch-tree--backward ()
- (interactive)
- (jao-notmuch-tree--forward t))
-
- (defun jao-notmuch--via-url ()
- (when (window-live-p notmuch-tree-message-window)
- (with-selected-window notmuch-tree-message-window
- (goto-char (point-min))
- (when (re-search-forward "^Via: http" nil t)
- (thing-at-point-url-at-point)))))
-
- (defun jao-notmuch-browse-url (ext)
- (interactive "P")
- (when-let (url (or (jao-notmuch--via-url)
- (car (last (jao-notmuch-message-urls)))))
- (funcall (if ext browse-url-secondary-browser-function #'browse-url)
- url)))
-
:bind (:map notmuch-tree-mode-map
(("b" . jao-notmuch-browse-urls)
("d" . jao-notmuch-tree-toggle-delete)