newbie questions about notmuch.el

Tom Hirschowitz tom.hirschowitz at univ-smb.fr
Fri Sep 8 05:04:02 PDT 2017


> Yes, I think there has to be some mistake in what Tom quoted

Indeed :)

Regarding Julien's question:

> Tom, do you have a function defined for this ?

Yes, probably utterly naive, wrong, etc. Would be happy to be corrected, in particular about how to avoid code triplication.
There you go:

(defun notmuch-show-flag  () 
  "Switch the flagged tag for the current thread or region." 
  (interactive) 
  (let ((tag-changes (if (member "flagged" (notmuch-show-get-tags)) (list "-flagged") (list "+flagged"))))
    (notmuch-show-tag tag-changes)))

(defun notmuch-search-flag  (&optional beg end) 
  "Switch the flagged tag for the current thread or region." 
  (interactive) 
  (let ((tag-changes (if (member "flagged" (notmuch-search-get-tags)) (list "-flagged") (list "+flagged"))))
    (notmuch-search-tag tag-changes beg end)))

(defun notmuch-tree-flag ()
  "Switch the flagged tag for the current thread or region." 
  (interactive)
  (let ((tag-changes (if (member "flagged" (notmuch-tree-get-tags)) (list "-flagged") (list "+flagged"))))
    (notmuch-tree-tag tag-changes)))

(define-key notmuch-show-mode-map (kbd "SPC") 'notmuch-show-flag) 
(define-key notmuch-search-mode-map (kbd "SPC") 'notmuch-search-flag) 
(define-key notmuch-tree-mode-map (kbd "SPC") 'notmuch-tree-flag) 


More information about the notmuch mailing list