* add user-settable variables mu4e-view-wrap-lines and mu4e-view-hide-cited,
which determine the initial way a message is displayed. document this.
This commit is contained in:
@ -55,7 +55,9 @@ wanting to show specific messages - for example, `mu4e-org'."
|
|||||||
"Display the message MSG in a new buffer, and keep in sync with HDRSBUF.
|
"Display the message MSG in a new buffer, and keep in sync with HDRSBUF.
|
||||||
'In sync' here means that moving to the next/previous message in
|
'In sync' here means that moving to the next/previous message in
|
||||||
the the message view affects HDRSBUF, as does marking etc. If
|
the the message view affects HDRSBUF, as does marking etc. If
|
||||||
UPDATE is non-nil, the current message will be (visually) updated.
|
UPDATE is nil, the current message may be (visually) 'massaged',
|
||||||
|
based on the settings of `mu4e-view-wrap-lines' and
|
||||||
|
`mu4e-view-hide-cited'.
|
||||||
|
|
||||||
As a side-effect, a message that is being viewed loses its 'unread'
|
As a side-effect, a message that is being viewed loses its 'unread'
|
||||||
marking if it still had that."
|
marking if it still had that."
|
||||||
@ -69,7 +71,6 @@ marking if it still had that."
|
|||||||
(let ((fieldname (cdr (assoc field mu4e-header-names)))
|
(let ((fieldname (cdr (assoc field mu4e-header-names)))
|
||||||
(fieldval (plist-get msg field)))
|
(fieldval (plist-get msg field)))
|
||||||
(case field
|
(case field
|
||||||
|
|
||||||
(:subject (mu4e-view-header fieldname fieldval))
|
(:subject (mu4e-view-header fieldname fieldval))
|
||||||
(:path (mu4e-view-header fieldname fieldval))
|
(:path (mu4e-view-header fieldname fieldval))
|
||||||
(:maildir (mu4e-view-header fieldname fieldval))
|
(:maildir (mu4e-view-header fieldname fieldval))
|
||||||
@ -122,6 +123,15 @@ marking if it still had that."
|
|||||||
(mu4e-mark-footer)
|
(mu4e-mark-footer)
|
||||||
(mu4e-make-urls-clickable)
|
(mu4e-make-urls-clickable)
|
||||||
|
|
||||||
|
(unless update
|
||||||
|
;; if we're showing the message for the first time, use the values of
|
||||||
|
;; user-settable variables `mu4e-view-wrap-lines' and
|
||||||
|
;; `mu4e-view-hide-cited' to determine whether we should wrap/hide
|
||||||
|
(progn
|
||||||
|
(when mu4e-view-wrap-lines (mu4e-view-wrap-lines))
|
||||||
|
(when mu4e-view-hide-cited (mu4e-view-hide-cited))))
|
||||||
|
|
||||||
|
;; no use in trying to set flags again
|
||||||
(unless update
|
(unless update
|
||||||
(mu4e-view-mark-as-read-maybe)))))
|
(mu4e-view-mark-as-read-maybe)))))
|
||||||
|
|
||||||
@ -328,13 +338,8 @@ if IS-OPEN is nil, and otherwise open it."
|
|||||||
(fset 'mu4e-view-mode-map mu4e-view-mode-map)
|
(fset 'mu4e-view-mode-map mu4e-view-mode-map)
|
||||||
|
|
||||||
|
|
||||||
(defvar mu4e-wrap-lines nil
|
(defvar mu4e-lines-wrapped nil "*internal* Whether lines are wrapped.")
|
||||||
"*internal* Whether to wrap lines or not (variable controlled by
|
(defvar mu4e-cited-hidden nil "*internal* Whether cited lines are hidden.")
|
||||||
`mu4e-view-toggle-wrap-lines').")
|
|
||||||
|
|
||||||
(defvar mu4e-hide-cited nil
|
|
||||||
"*internal* Whether to hide cited lines or not (the variable can
|
|
||||||
be changed with `mu4e-view-toggle-hide-cited').")
|
|
||||||
|
|
||||||
(define-derived-mode mu4e-view-mode special-mode "mu4e:view"
|
(define-derived-mode mu4e-view-mode special-mode "mu4e:view"
|
||||||
"Major mode for viewing an e-mail message in mu4e.
|
"Major mode for viewing an e-mail message in mu4e.
|
||||||
@ -345,14 +350,18 @@ if IS-OPEN is nil, and otherwise open it."
|
|||||||
(make-local-variable 'mu4e-current-msg)
|
(make-local-variable 'mu4e-current-msg)
|
||||||
(make-local-variable 'mu4e-link-map)
|
(make-local-variable 'mu4e-link-map)
|
||||||
|
|
||||||
(make-local-variable 'mu4e-wrap-lines)
|
(make-local-variable 'mu4e-lines-wrapped)
|
||||||
(make-local-variable 'mu4e-hide-cited)
|
(make-local-variable 'mu4e-cited-hidden)
|
||||||
|
|
||||||
(setq
|
;; filladapt is much better than the built-in filling
|
||||||
truncate-lines t))
|
;; esp. with '>' cited parts
|
||||||
|
(when (fboundp 'filladapt-mode)
|
||||||
|
(filladapt-mode))
|
||||||
|
|
||||||
|
(setq truncate-lines t))
|
||||||
|
|
||||||
|
|
||||||
;; we mark messages are as read when we leave the message; ie., when skipping to
|
;; we mark messages are as read when we leave the message; i.e., when skipping to
|
||||||
;; the next/previous one, or leaving the view buffer altogether.
|
;; the next/previous one, or leaving the view buffer altogether.
|
||||||
|
|
||||||
(defun mu4e-view-mark-as-read-maybe ()
|
(defun mu4e-view-mark-as-read-maybe ()
|
||||||
@ -372,7 +381,7 @@ Seen; if the message is not New/Unread, do nothing."
|
|||||||
(let ((more-lines t))
|
(let ((more-lines t))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while more-lines
|
(while more-lines
|
||||||
;; Get the citation level at point -- ie., the number of '>'
|
;; Get the citation level at point -- i.e., the number of '>'
|
||||||
;; prefixes, starting with 0 for 'no citation'
|
;; prefixes, starting with 0 for 'no citation'
|
||||||
(beginning-of-line 1)
|
(beginning-of-line 1)
|
||||||
(let* ((text (re-search-forward "[[:word:]]" (line-end-position 1) t 1))
|
(let* ((text (re-search-forward "[[:word:]]" (line-end-position 1) t 1))
|
||||||
@ -422,7 +431,6 @@ Seen; if the message is not New/Unread, do nothing."
|
|||||||
(browse-url url))))
|
(browse-url url))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; this is fairly simplistic...
|
;; this is fairly simplistic...
|
||||||
(defun mu4e-make-urls-clickable ()
|
(defun mu4e-make-urls-clickable ()
|
||||||
"Turn things that look like URLs into clickable things, and
|
"Turn things that look like URLs into clickable things, and
|
||||||
@ -553,45 +561,51 @@ See the `org-contacts' documentation for more details."
|
|||||||
((eq name-or-email 'email)
|
((eq name-or-email 'email)
|
||||||
(or (cdr-safe from) ""))
|
(or (cdr-safe from) ""))
|
||||||
(t (error "Not supported: %S" name-or-email))))))
|
(t (error "Not supported: %S" name-or-email))))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun mu4e-view-wrap-lines ()
|
||||||
|
"Wrap lines in the message body."
|
||||||
|
(save-excursion
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(when (search-forward "\n\n") ;; search for the message body
|
||||||
|
(fill-region (point) (point-max)))
|
||||||
|
(setq mu4e-lines-wrapped t))))
|
||||||
|
|
||||||
|
(defun mu4e-view-hide-cited ()
|
||||||
|
"Toggle hiding of cited lines in the message body."
|
||||||
|
(save-excursion
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(flush-lines "^[:blank:]*>")
|
||||||
|
(setq mu4e-cited-hidden t))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Interactive functions
|
;; Interactive functions
|
||||||
|
|
||||||
(defun mu4e-view-toggle-wrap-lines ()
|
(defun mu4e-view-toggle-wrap-lines ()
|
||||||
"Toggle line wrap in the message body."
|
"Toggle line wrap in the message body."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if mu4e-wrap-lines
|
(if mu4e-lines-wrapped
|
||||||
(progn
|
(mu4e-view-refresh)
|
||||||
(setq mu4e-wrap-lines nil)
|
(mu4e-view-wrap-lines)))
|
||||||
(mu4e-view-refresh)) ;; back to normal
|
|
||||||
(save-excursion
|
|
||||||
(let ((inhibit-read-only t))
|
|
||||||
(setq mu4e-wrap-lines t)
|
|
||||||
(goto-char (point-min))
|
|
||||||
(when (search-forward "\n\n") ;; search for the message body
|
|
||||||
(fill-region (point) (point-max)))))))
|
|
||||||
|
|
||||||
(defun mu4e-view-toggle-hide-cited ()
|
(defun mu4e-view-toggle-hide-cited ()
|
||||||
"Toggle hiding of cited lines in the message body."
|
"Toggle hiding of cited lines in the message body."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if mu4e-hide-cited
|
(if mu4e-cited-hidden
|
||||||
(progn
|
(mu4e-view-refresh)
|
||||||
(setq mu4e-hide-cited nil)
|
(mu4e-view-hide-cited)))
|
||||||
(mu4e-view-refresh))
|
|
||||||
(save-excursion
|
|
||||||
(let ((inhibit-read-only t))
|
|
||||||
(goto-char (point-min))
|
|
||||||
(flush-lines "^[:blank:]*>")
|
|
||||||
(setq mu4e-hide-cited t)))))
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-view-refresh ()
|
(defun mu4e-view-refresh ()
|
||||||
"Redisplay the current message."
|
"Redisplay the current message, without wrapped lines or hidden
|
||||||
|
citations."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mu4e-view mu4e-current-msg mu4e-hdrs-buffer t))
|
(mu4e-view mu4e-current-msg mu4e-hdrs-buffer t)
|
||||||
|
(setq
|
||||||
|
mu4e-lines-wrapped nil
|
||||||
|
mu4e-cited-hidden nil))
|
||||||
|
|
||||||
(defun mu4e-view-quit-buffer ()
|
(defun mu4e-view-quit-buffer ()
|
||||||
"Quit the message view and return to the headers."
|
"Quit the message view and return to the headers."
|
||||||
|
|||||||
@ -137,7 +137,7 @@ sent folder."
|
|||||||
;; Folders
|
;; Folders
|
||||||
|
|
||||||
(defgroup mu4e-folders nil
|
(defgroup mu4e-folders nil
|
||||||
"Special folders for mm."
|
"Special folders."
|
||||||
:group 'mu4e)
|
:group 'mu4e)
|
||||||
|
|
||||||
(defcustom mu4e-sent-folder "/sent"
|
(defcustom mu4e-sent-folder "/sent"
|
||||||
@ -241,6 +241,31 @@ recommended you use \"html2text -utf8 -width 72\"."
|
|||||||
:group 'mu4e-view
|
:group 'mu4e-view
|
||||||
:safe 'stringp)
|
:safe 'stringp)
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom mu4e-view-wrap-lines nil
|
||||||
|
"Whether to automatically wrap lines in the body of messages when
|
||||||
|
viewing them. Note that wrapping does not work well with all
|
||||||
|
messages, but you can always toggle between wrapped/unwrapped
|
||||||
|
display with `mu4e-view-toggle-wrap-lines (default keybinding: <w>)."
|
||||||
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
(defcustom mu4e-view-wrap-lines nil
|
||||||
|
"Whether to automatically wrap lines in the body of messages when
|
||||||
|
viewing them. Note that wrapping does not work well with all
|
||||||
|
messages, but you can always toggle between wrapped/unwrapped
|
||||||
|
display with `mu4e-view-toggle-wrap-lines (default keybinding: <w>)."
|
||||||
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom mu4e-view-hide-cited nil
|
||||||
|
"Whether to automatically hide cited parts of messages (as
|
||||||
|
determined by the presence of '> ' at the beginning of the
|
||||||
|
line). Note that you can always toggle between hidden/unhidden
|
||||||
|
display with `mu4e-view-toggle-hide-cited (default keybinding:
|
||||||
|
<w>)."
|
||||||
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
|
||||||
;; Composing / Sending messages
|
;; Composing / Sending messages
|
||||||
(defgroup mu4e-compose nil
|
(defgroup mu4e-compose nil
|
||||||
"Customizations for composing/sending messages."
|
"Customizations for composing/sending messages."
|
||||||
@ -283,18 +308,18 @@ sent folder."
|
|||||||
;; Faces
|
;; Faces
|
||||||
|
|
||||||
(defgroup mu4e-faces nil
|
(defgroup mu4e-faces nil
|
||||||
"Faces used in by mm."
|
"Type faces (fonts) used in mu4e."
|
||||||
:group 'mu4e
|
:group 'mu4e
|
||||||
:group 'faces)
|
:group 'faces)
|
||||||
|
|
||||||
(defface mu4e-unread-face
|
(defface mu4e-unread-face
|
||||||
'((t :inherit font-lock-keyword-face :bold t))
|
'((t :inherit font-lock-keyword-face :bold t))
|
||||||
"Face for an unread mm message header."
|
"Face for an unread message header."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-moved-face
|
(defface mu4e-moved-face
|
||||||
'((t :inherit font-lock-comment-face :slant italic))
|
'((t :inherit font-lock-comment-face :slant italic))
|
||||||
"Face for an mm message header that has been moved to some
|
"Face for a message header that has been moved to some
|
||||||
folder (it's still visible in the search results, since we cannot
|
folder (it's still visible in the search results, since we cannot
|
||||||
be sure it no longer matches)."
|
be sure it no longer matches)."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
@ -312,22 +337,24 @@ flag set)."
|
|||||||
|
|
||||||
(defface mu4e-header-face
|
(defface mu4e-header-face
|
||||||
'((t :inherit default))
|
'((t :inherit default))
|
||||||
"Face for an mm header without any special flags."
|
"Face for a header without any special flags."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-title-face
|
(defface mu4e-header-title-face
|
||||||
'((t :inherit font-lock-type-face))
|
'((t :inherit font-lock-type-face :underline t))
|
||||||
"Face for an mm title."
|
"Face for a header title in the headers view."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-view-header-key-face
|
(defface mu4e-view-header-key-face
|
||||||
'((t :inherit font-lock-builtin-face :bold t))
|
'((t :inherit font-lock-builtin-face :bold t))
|
||||||
"Face for the header title (such as \"Subject\" in the message view)."
|
"Face for a header title (such as \"Subject\") in the message
|
||||||
|
view."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-view-header-value-face
|
(defface mu4e-view-header-value-face
|
||||||
'((t :inherit font-lock-doc-face))
|
'((t :inherit font-lock-doc-face))
|
||||||
"Face for the header value (such as \"Re: Hello!\" in the message view)."
|
"Face for a header value (such as \"Re: Hello!\") in the message
|
||||||
|
view."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-view-link-face
|
(defface mu4e-view-link-face
|
||||||
@ -408,7 +435,7 @@ view). Most fields should be self-explanatory. A special one is
|
|||||||
in which case it will be equal to `:to'.)")
|
in which case it will be equal to `:to'.)")
|
||||||
|
|
||||||
|
|
||||||
;; mm startup function ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defun mu4e-create-maildir-maybe (dir)
|
(defun mu4e-create-maildir-maybe (dir)
|
||||||
"Offer to create DIR if it does not exist yet. Return t if the
|
"Offer to create DIR if it does not exist yet. Return t if the
|
||||||
dir already existed, or has been created, nil otherwise."
|
dir already existed, or has been created, nil otherwise."
|
||||||
@ -449,7 +476,7 @@ dir already existed, or has been created, nil otherwise."
|
|||||||
"*internal* The mu4e update timer.")
|
"*internal* The mu4e update timer.")
|
||||||
|
|
||||||
(defun mu4e ()
|
(defun mu4e ()
|
||||||
"Start mm. We do this by sending a 'ping' to the mu server
|
"Start mu4e. We do this by sending a 'ping' to the mu server
|
||||||
process, and start the main view if the 'pong' we receive from the
|
process, and start the main view if the 'pong' we receive from the
|
||||||
server has the expected values."
|
server has the expected values."
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -477,7 +504,7 @@ server has the expected values."
|
|||||||
(mu4e-proc-ping)))))
|
(mu4e-proc-ping)))))
|
||||||
|
|
||||||
(defun mu4e-quit()
|
(defun mu4e-quit()
|
||||||
"Quit the mm session."
|
"Quit the mu4e session."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (y-or-n-p "Are you sure you want to quit? ")
|
(when (y-or-n-p "Are you sure you want to quit? ")
|
||||||
(message nil)
|
(message nil)
|
||||||
|
|||||||
@ -555,11 +555,20 @@ On Sun 21 Dec 2003 09:06:34 PM EET, Paul wrote:
|
|||||||
|
|
||||||
Some notes:
|
Some notes:
|
||||||
@itemize
|
@itemize
|
||||||
@item You can customize the header fields to show by setting the
|
@item You can determine which header fields are shown by setting the
|
||||||
variable @code{mu4e-view-fields}.
|
variable @code{mu4e-view-fields}.
|
||||||
@item You can customize the date format by setting the variable
|
@item You can customize the date format by setting the variable
|
||||||
@code{mu4e-date-format-long}, using the same format that
|
@code{mu4e-date-format-long}, using the same format that
|
||||||
@code{format-time-string} uses.
|
@code{format-time-string} uses.
|
||||||
|
@item The body text can be line-wrapped (toggle between wrapped/not-wrapped with
|
||||||
|
@key{w}) and/or cited parts can be hidden (toggle between hidden/not-hidden
|
||||||
|
with @key{h}. If you want to do this by default when viewing messages, you can
|
||||||
|
set, respectively, @code{mu4e-view-wrap-lines} and @code{mu4e-view-hide-cited}
|
||||||
|
to @code{t}. @footnote{If you have installed the @t{filladapt} package
|
||||||
|
(@url{http://www.wonderworks.com/download/filladapt.el}), @t{mu4e} will use
|
||||||
|
it for line-wrapping, as it generally does a better job than the default
|
||||||
|
mechanism emacs provides.}
|
||||||
|
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
You can find most things you can do with this message in the @emph{View} menu,
|
You can find most things you can do with this message in the @emph{View} menu,
|
||||||
@ -630,11 +639,6 @@ set up with something like the following in your initialization files:
|
|||||||
Normally, @t{mu4e} prefers the text-version of an e-mail message to determine
|
Normally, @t{mu4e} prefers the text-version of an e-mail message to determine
|
||||||
the message body. You can change this by setting @code{mu4e-view-prefer-html}.
|
the message body. You can change this by setting @code{mu4e-view-prefer-html}.
|
||||||
|
|
||||||
Note: if you have installed the
|
|
||||||
@t{filladapt}@footnote{@url{http://www.wonderworks.com/download/filladapt.el}}
|
|
||||||
package, @t{mu4e} will use it for line-wrapping of the body text (@key{w}), as
|
|
||||||
it generally does a better job than the mechanism emacs provides by default.
|
|
||||||
|
|
||||||
@node Editor view
|
@node Editor view
|
||||||
@section Editor view
|
@section Editor view
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user