(re-search-forward "[a-fA-F0-9]*")
(filter-buffer-substring beg (point)))))
+(defun notmuch-search-markup-this-thread-id ()
+ (beginning-of-line)
+ (let ((beg (point)))
+ (re-search-forward "[a-fA-F0-9]*")
+ (forward-char)
+ (overlay-put (make-overlay beg (point)) 'invisible 'notmuch-search)))
+
+(defun notmuch-search-markup-thread-ids ()
+ (save-excursion
+ (beginning-of-buffer)
+ (while (not (eobp))
+ (notmuch-search-markup-this-thread-id)
+ (next-line))))
+
+(defun notmuch-search-hide-thread-ids ()
+ (interactive)
+ (add-to-invisibility-spec 'notmuch-search))
+
+(defun notmuch-search-show-thread-ids ()
+ (interactive)
+ (remove-from-invisibility-spec 'notmuch-search))
+
(defun notmuch-search-show-thread ()
(interactive)
(notmuch-show (notmuch-search-find-thread-id)))
(error (buffer-substring beg end))
))))))
+(defun notmuch-search-set-tags (tags)
+ (save-excursion
+ (end-of-line)
+ (re-search-backward "(")
+ (forward-char)
+ (let ((beg (point))
+ (inhibit-read-only t))
+ (re-search-forward ")")
+ (backward-char)
+ (let ((end (point)))
+ (delete-region beg end)
+ (insert (mapconcat 'identity tags " "))))))
+
+(defun notmuch-search-get-tags ()
+ (save-excursion
+ (end-of-line)
+ (re-search-backward "(")
+ (let ((beg (+ (point) 1)))
+ (re-search-forward ")")
+ (let ((end (- (point) 1)))
+ (split-string (buffer-substring beg end))))))
+
(defun notmuch-search-add-tag (tag)
(interactive "sTag to add: ")
- (notmuch-search-call-notmuch-process "tag" (concat "+" tag) (concat "thread:" (notmuch-search-find-thread-id))))
+ (notmuch-search-call-notmuch-process "tag" (concat "+" tag) (concat "thread:" (notmuch-search-find-thread-id)))
+ (notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<))))
(defun notmuch-search-remove-tag (tag)
(interactive "sTag to remove: ")
- (notmuch-search-call-notmuch-process "tag" (concat "-" tag) (concat "thread:" (notmuch-search-find-thread-id))))
+ (notmuch-search-call-notmuch-process "tag" (concat "-" tag) (concat "thread:" (notmuch-search-find-thread-id)))
+ (notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
(defun notmuch-search-archive-thread ()
(interactive)
(save-excursion
(call-process "notmuch" nil t nil "search" query)
)
+ (notmuch-search-markup-thread-ids)
)))
(defun notmuch ()