aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-11-11 16:48:31 -0500
committerDavid Bremner <david@tethera.net>2022-11-15 07:34:25 -0400
commit5ba7684445b9338ab289d502d4688d9aff3d8803 (patch)
tree45c1f466894a9b5268ca132fb707e37fca57dc4d /emacs
parent056249627ac68823e5246b2586db9fbb8002c6b0 (diff)
emacs/show: use n-s-i-headerline to update tags
Although this has more steps than the previous regular expression search and replace, it should be more robust against changes in the headerline format, such as the inclusion of duplicate numbers (which broke the previous version).
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index be68fc3b..36cce619 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -452,14 +452,19 @@ operation on the contents of the current buffer."
(defun notmuch-show-update-tags (tags)
"Update the displayed tags of the current message."
(save-excursion
- (goto-char (notmuch-show-message-top))
- (when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
- (let ((inhibit-read-only t))
- (replace-match (concat "("
- (notmuch-tag-format-tags
- tags
- (notmuch-show-get-prop :orig-tags))
- ")"))))))
+ (let ((inhibit-read-only t)
+ (start (notmuch-show-message-top))
+ (depth (notmuch-show-get-prop :depth))
+ (orig-tags (notmuch-show-get-prop :orig-tags))
+ (props (notmuch-show-get-message-properties))
+ (extent (notmuch-show-message-extent)))
+ (goto-char start)
+ (notmuch-show-insert-headerline props depth tags orig-tags)
+ (put-text-property start (1+ start)
+ :notmuch-message-properties props)
+ (put-text-property (car extent) (cdr extent) :notmuch-message-extent extent)
+ ;; delete original headerline, but do not save to kill ring
+ (delete-region (point) (1+ (line-end-position))))))
(defun notmuch-clean-address (address)
"Try to clean a single email ADDRESS for display. Return a cons