mu4e.texi: Add compose-mode example

This commit is contained in:
djcb
2018-01-06 14:48:28 +02:00
parent 90868bd637
commit ef8c1960de

View File

@ -995,10 +995,11 @@ headers} in both the headers-view and the message-view.
You can do so by adding a description of your custom header to You can do so by adding a description of your custom header to
@code{mu4e-header-info-custom}, which is a list of custom headers. @code{mu4e-header-info-custom}, which is a list of custom headers.
Let's look at an example --- suppose we want to add a custom header that shows Let's look at an example --- suppose we want to add a custom header that
the number of recipients for a message, i.e., the sum of the number of shows the number of recipients for a message, i.e., the sum of the
recipients in the @t{To:} and @t{Cc:} fields. Let's further suppose that our function number of recipients in the @t{To:} and @t{Cc:} fields. Let's further
takes a message-plist as its argument (@ref{Message functions}). suppose that our function takes a message-plist as its argument
(@ref{Message functions}).
@lisp @lisp
(add-to-list 'mu4e-header-info-custom (add-to-list 'mu4e-header-info-custom
@ -1342,8 +1343,8 @@ the @t{shr} key bindings, with something like:
(local-set-key (kbd "<backtab>") 'shr-previous-link))) (local-set-key (kbd "<backtab>") 'shr-previous-link)))
@end lisp @end lisp
If you're using a dark theme, and the messages are hard to read, it can help to change If you're using a dark theme, and the messages are hard to read, it can
the luminosity, e.g.: help to change the luminosity, e.g.:
@lisp @lisp
(setq shr-color-visible-luminance-min 80) (setq shr-color-visible-luminance-min 80)
@end lisp @end lisp
@ -1447,26 +1448,28 @@ This starts the daemon, and sets the environment variable.
@subsection Decryption @subsection Decryption
@anchor{Decryption} @anchor{Decryption}
If you receive messages that are encrypted (using PGP/MIME), @t{mu4e} can try If you receive messages that are encrypted (using PGP/MIME), @t{mu4e}
to decrypt them, base on the setting of @code{mu4e-decryption-policy}. If you can try to decrypt them, base on the setting of
set it to @t{t}, @t{mu4e} attempts to decrypt messages automatically; this is @code{mu4e-decryption-policy}. If you set it to @t{t}, @t{mu4e} attempts
the default. If you set it to @t{nil}, @t{mu4e} @emph{won't} attempt to to decrypt messages automatically; this is the default. If you set it to
decrypt anything. Finally, if you set it to @t{'ask}, it asks you what to do, @t{nil}, @t{mu4e} @emph{won't} attempt to decrypt anything. Finally, if
each time an encrypted message is encountered. you set it to @t{'ask}, it asks you what to do, each time an encrypted
message is encountered.
When opening an encrypted message, @t{mu} consults @t{gpg-agent} to see if it When opening an encrypted message, @t{mu} consults @t{gpg-agent} to see
already has unlocked the key needed to decrypt the message; if not, it prompts if it already has unlocked the key needed to decrypt the message; if
you for a password (typically with a separate top-level window). This is only not, it prompts you for a password (typically with a separate top-level
needed once per session. window). This is only needed once per session.
@subsection Verifying signatures @subsection Verifying signatures
@anchor{Verifying signatures} @anchor{Verifying signatures}
Some e-mail messages are cryptographically signed, and @t{mu4e} can check the Some e-mail messages are cryptographically signed, and @t{mu4e} can
validity of these signatures. If a message has one or more signatures, the check the validity of these signatures. If a message has one or more
message view shows an extra header @t{Signature:} (assuming it is part of your signatures, the message view shows an extra header @t{Signature:}
@code{mu4e-view-fields}), and one or more `verdicts' of the signatures found; (assuming it is part of your @code{mu4e-view-fields}), and one or more
either @t{verified}, @t{unverified} or @t{error}. For instance: `verdicts' of the signatures found; either @t{verified}, @t{unverified}
or @t{error}. For instance:
@verbatim @verbatim
Signature: unverified (Details) Signature: unverified (Details)
@ -1673,8 +1676,8 @@ Let's look at some examples. First, suppose we want to set the
(t "me@@cuux.example.com"))))))) (t "me@@cuux.example.com")))))))
@end lisp @end lisp
Second, as mentioned, @code{mu4e-compose-mode-hook} is especially useful for Secondly, as mentioned, @code{mu4e-compose-mode-hook} is especially
editing-related settings. For example: useful for editing-related settings. For example:
@lisp @lisp
(add-hook 'mu4e-compose-mode-hook (add-hook 'mu4e-compose-mode-hook
(defun my-do-compose-stuff () (defun my-do-compose-stuff ()
@ -1695,6 +1698,21 @@ message is fully formed when this hook runs. For example, to add a
(save-excursion (message-add-header "Bcc: me@@example.com\n")))) (save-excursion (message-add-header "Bcc: me@@example.com\n"))))
@end lisp @end lisp
Or to something context-specific:
@lisp
(add-hook 'mu4e-compose-mode-hook
(lambda()
(let* ((ctx (mu4e-context-current))
(name (if ctx (mu4e-context-name ctx))))
(when name
(cond
((string= name "account1")
(save-excursion (message-add-header "Bcc: account1@@example.com\n")))
((string= name "account2")
(save-excursion (message-add-header "Bcc: account2@@example.com\n"))))))))
@end lisp
@noindent @noindent
For a more general discussion about extending @t{mu4e}, see @ref{Extending For a more general discussion about extending @t{mu4e}, see @ref{Extending
mu4e}. mu4e}.