summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--custom/jao-custom-gnus.el10
-rw-r--r--custom/jao-custom-notmuch.el23
-rw-r--r--lib/net/jao-notmuch.el7
-rw-r--r--lib/net/jao-url.el9
4 files changed, 32 insertions, 17 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 409860c..dad3de1 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -592,14 +592,10 @@
(when (eq major-mode 'gnus-summary-mode)
(gnus-summary-select-article-buffer))
(save-excursion
- (goto-char (point-min))
- (when (or (search-forward-regexp "^Via: h" nil t)
- (search-forward-regexp "^URL:[\n ]h" nil t)
- (and (search-forward-regexp "^Link$" nil t)
- (not (beginning-of-line))))
+ (when-let* ((url (jao-url-email-url)))
(cond (external (jao-browse-with-external-browser))
- ((featurep 'jao-custom-eww) (eww (jao-url-around-point)))
- (t (browse-url (jao-url-around-point)))))))
+ ((featurep 'jao-custom-eww) (eww url))
+ (t (browse-url url))))))
(defun jao-gnus-from-eww (keep-eww-buffer)
(interactive "P")
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 4d797c8..18c62b7 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -462,16 +462,25 @@
(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)))))
+ (jao-url-email-url))))
(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)))
+ (when-let* ((url (or (jao-notmuch--via-url)
+ (car (last (jao-notmuch-message-urls))))))
+ (if ext
+ (funcall browse-url-secondary-browser-function url)
+ (window-configuration-to-register ?G)
+ (select-window notmuch-tree-message-window)
+ (eww url))))
+
+(defun jao-notmuch-from-eww (keep-eww-buffer)
+ (interactive "P")
+ (unless keep-eww-buffer (jao-eww-close))
+ (jump-to-register ?G))
+
+(with-eval-after-load 'eww
+ (define-key eww-mode-map (kbd "h") #'jao-notmuch-from-eww))
(defun jao-notmuch-adjust-tree-fonts (&optional family)
(let ((fg (face-attribute 'jao-themes-dimm :foreground)))
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 73f6420..404eab7 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -212,7 +212,7 @@
(with-current-buffer notmuch-tree-message-buffer
(jao-notmuch--view-html))))))
-;;; header line with thread message counts
+;;; header and mode lines with thread message counts
(defun jao-notmuch--looking-at-new-p (&optional p)
(when-let (ts (if p (plist-get p :tags) (notmuch-show-get-tags)))
@@ -266,7 +266,8 @@
(with-current-buffer b
(and (derived-mode-p 'notmuch-tree-mode) b)))
(buffer-list))))
- `((:eval (jao-notmuch--format-header-line ,(buffer-name tb) ,cb ,subject)))
+ `((:eval
+ (jao-notmuch--format-header-line ,(buffer-name tb) ,cb ,subject)))
(concat " " subject)))
(defun jao-notmuch--format-lighter ()
@@ -353,7 +354,7 @@
;;; fcc
(defvar jao-notmuch-tags-not-inherited
- '("attachment" "sent" "new" "trove" "flagged" "drivel"))
+ '("attachment" "sent" "new" "trove" "flagged" "drivel" "replied"))
(defvar jao-notmuch-sent-dir "sent")
diff --git a/lib/net/jao-url.el b/lib/net/jao-url.el
index 9e58f99..ac66cef 100644
--- a/lib/net/jao-url.el
+++ b/lib/net/jao-url.el
@@ -32,5 +32,14 @@
(and (derived-mode-p 'eww-mode) (plist-get eww-data :url))))))
+(defun jao-url-email-url ()
+ (save-excursion
+ (goto-char (point-min))
+ (when (or (search-forward-regexp "^Via: h" nil t)
+ (search-forward-regexp "^URL:[\n ]h" nil t)
+ (and (search-forward-regexp "^Link$" nil t)
+ (not (beginning-of-line))))
+ (jao-url-around-point))))
+
(provide 'jao-url)
;;; jao-url.el ends here