mu4e: fix documentation for adding custom marks

This commit is contained in:
Dirk-Jan C. Binnema 2023-06-04 14:54:31 +03:00
parent 00fbcfb39f
commit 3624fdd5f3
1 changed files with 14 additions and 16 deletions

View File

@ -2370,8 +2370,8 @@ messages. There are more examples in the defaults for
@node Adding a new kind of mark @node Adding a new kind of mark
@section Adding a new kind of mark @section Adding a new kind of mark
It is possible to configure new marks. To do so, one can add entries It is possible to configure new marks, by adding elements to the list
in the list @code{mu4e-marks}. Such an element must have the following form: @code{mu4e-marks}. Such an element must have the following form:
@lisp @lisp
(SYMBOL (SYMBOL
@ -2383,9 +2383,9 @@ in the list @code{mu4e-marks}. Such an element must have the following form:
:action (lambda (DOCID MSG DYN-TARGET) nil)) :action (lambda (DOCID MSG DYN-TARGET) nil))
@end lisp @end lisp
The symbol can be any symbol, except for @code{'unmark} and The symbol can be any symbol, except for the symbols @code{unmark} and
@code{'something}, which are reserved. The rest is a plist with the @code{something}, which are reserved. The rest is a plist with the following
following elements: elements:
@itemize @itemize
@item @code{:char} --- the character to display in the headers view. @item @code{:char} --- the character to display in the headers view.
@ -2404,9 +2404,8 @@ If @code{:show-target} is @t{nil} the @t{DYN-TARGET} is shown (and
@item @code{:action} --- the action to apply on the message when the mark is executed. @item @code{:action} --- the action to apply on the message when the mark is executed.
@end itemize @end itemize
As an example, suppose we would like to add a mark for tagging As an example, suppose we would like to add a mark for tagging messages
messages (GMail-style), then we can run the following code (after (GMail-style). We can use the following code (after loading @t{mu4e}):
loading @t{mu4e}):
@lisp @lisp
(add-to-list 'mu4e-marks (add-to-list 'mu4e-marks
@ -2414,22 +2413,21 @@ loading @t{mu4e}):
:char "g" :char "g"
:prompt "gtag" :prompt "gtag"
:ask-target (lambda () (read-string "What tag do you want to add?")) :ask-target (lambda () (read-string "What tag do you want to add?"))
:action (lambda (docid msg target) :action (lambda (docid msg target)
(mu4e-action-retag-message msg (concat "+" target))))) (mu4e-action-retag-message msg (concat "+" target)))))
@end lisp @end lisp
Adding to @code{mu4e-marks} list allows to use the mark in bulk operations Adding elements to @code{mu4e-marks} (as in the example) allows you to use the
(for example when tagging a whole thread), but does not bind the mark mark in bulk operations (for example when tagging a whole thread); if you also
to a key to use at the top-level. This must be done separately. In our want to add a key-binding for the headers view, you can use something like:
example:
@lisp @lisp
(defun my-mu4e-mark-add-tag() (defun my-mu4e-mark-add-tag()
"Add a tag to the message." "Add a tag to the message at point."
(interactive) (interactive)
(mu4e-headers-mark-and-next 'tag)) (mu4e-headers-mark-and-next 'tag))
(define-key mu4e-headers-mode-map (kbd "g") 'mu4e-headers-mark-for-tag) (define-key mu4e-headers-mode-map (kbd "g") #'my-mu4e-mark-add-tag)
@end lisp @end lisp
@node Contexts @node Contexts