mirror of https://github.com/djcb/mu.git
* mu4e: cleanup wrapping / hiding citations in view:
- use longlines mode (no need for filladapt, my own functions) - make mu4e-view-wrap-lines, mu4e-view-hide-cited obsolete; use a hook instead - update docs
This commit is contained in:
parent
f41dfd3ba5
commit
7cb695b787
|
@ -33,8 +33,7 @@
|
|||
(require 'mu4e-compose)
|
||||
(require 'mu4e-actions)
|
||||
|
||||
;; we prefer the improved fill-region
|
||||
(require 'filladapt nil 'noerror)
|
||||
(require 'longlines)
|
||||
(require 'comint)
|
||||
(require 'browse-url)
|
||||
(require 'button)
|
||||
|
@ -63,28 +62,16 @@ toggle between long/short display by klicking / M-RET on the
|
|||
contact."
|
||||
:type 'boolean
|
||||
: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)
|
||||
|
||||
(make-obsolete-variable 'mu4e-view-wrap-lines nil "0.9.9-dev7")
|
||||
(make-obsolete-variable 'mu4e-view-hide-cited nil "0.9.9-dev7")
|
||||
|
||||
(defcustom mu4e-view-date-format "%c"
|
||||
"Date format to use in the message view, in the format of
|
||||
`format-time-string'."
|
||||
:type 'string
|
||||
: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)
|
||||
|
||||
|
||||
(defcustom mu4e-view-image-max-width 800
|
||||
"The maximum width for images to display; this is only effective
|
||||
if you're using an emacs with Imagemagick support, and
|
||||
|
@ -123,9 +110,7 @@ The first letter of NAME is used as a shortcut character.")
|
|||
(defvar mu4e~view-headers-buffer nil
|
||||
"The headers buffer connected to this view.")
|
||||
|
||||
(defvar mu4e~view-lines-wrapped nil "Whether lines are wrapped.")
|
||||
(defvar mu4e~view-cited-hidden nil "Whether cited lines are hidden.")
|
||||
|
||||
(defvar mu4e~view-link-map nil
|
||||
"A map of some number->url so we can jump to url by number.")
|
||||
|
||||
|
@ -227,11 +212,6 @@ marking if it still had that."
|
|||
(mu4e~view-show-images-maybe msg)
|
||||
|
||||
(unless refresh
|
||||
;; 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
|
||||
(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
|
||||
(mu4e~view-mark-as-read-maybe))))))
|
||||
|
||||
|
@ -541,7 +521,7 @@ is nil, and otherwise open it."
|
|||
(define-key map (kbd "#") 'mu4e-mark-resolve-deferred-marks)
|
||||
|
||||
;; misc
|
||||
(define-key map "w" 'mu4e-view-toggle-wrap-lines)
|
||||
(define-key map "w" 'longlines-mode)
|
||||
(define-key map "h" 'mu4e-view-toggle-hide-cited)
|
||||
|
||||
(define-key map "r" 'mu4e-view-refresh)
|
||||
|
@ -565,7 +545,7 @@ is nil, and otherwise open it."
|
|||
|
||||
(define-key menumap [sepa0] '("--"))
|
||||
(define-key menumap [wrap-lines]
|
||||
'("Toggle wrap lines" . mu4e-view-toggle-wrap-lines))
|
||||
'("Toggle wrap lines" . longlines-mode))
|
||||
(define-key menumap [hide-cited]
|
||||
'("Toggle hide cited" . mu4e-view-toggle-hide-cited))
|
||||
(define-key menumap [raw-view]
|
||||
|
@ -631,8 +611,6 @@ is nil, and otherwise open it."
|
|||
(make-local-variable 'mu4e~view-msg)
|
||||
(make-local-variable 'mu4e~view-link-map)
|
||||
(make-local-variable 'mu4e~view-attach-map)
|
||||
|
||||
(make-local-variable 'mu4e~view-lines-wrapped)
|
||||
(make-local-variable 'mu4e~view-cited-hidden)
|
||||
|
||||
(setq buffer-undo-list t) ;; don't record undo info
|
||||
|
@ -751,14 +729,6 @@ number them so they can be opened using `mu4e-view-go-to-url'."
|
|||
'face 'mu4e-view-url-number-face))))))))
|
||||
|
||||
|
||||
(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~view-lines-wrapped t))))
|
||||
|
||||
(defun mu4e~view-hide-cited ()
|
||||
"Toggle hiding of cited lines in the message body."
|
||||
|
@ -802,15 +772,7 @@ N (prefix argument), to the Nth previous header."
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Interactive functions
|
||||
|
||||
|
||||
(defun mu4e-view-toggle-wrap-lines ()
|
||||
"Toggle line wrap in the message body."
|
||||
(interactive)
|
||||
(if mu4e~view-lines-wrapped
|
||||
(mu4e-view-refresh)
|
||||
(mu4e~view-wrap-lines)))
|
||||
|
||||
|
||||
(defun mu4e-view-toggle-hide-cited ()
|
||||
"Toggle hiding of cited lines in the message body."
|
||||
(interactive)
|
||||
|
@ -819,13 +781,10 @@ N (prefix argument), to the Nth previous header."
|
|||
(mu4e~view-hide-cited)))
|
||||
|
||||
(defun mu4e-view-refresh ()
|
||||
"Redisplay the current message, without wrapped lines or hidden
|
||||
citations."
|
||||
"Redisplay the current message."
|
||||
(interactive)
|
||||
(mu4e-view mu4e~view-msg mu4e~view-headers-buffer t)
|
||||
(setq
|
||||
mu4e~view-lines-wrapped nil
|
||||
mu4e~view-cited-hidden nil))
|
||||
(setq mu4e~view-cited-hidden nil))
|
||||
|
||||
(defun mu4e-view-action (&optional msg)
|
||||
"Ask user for some action to apply on MSG (or message-at-point,
|
||||
|
|
|
@ -759,14 +759,15 @@ the name, or pressing @key{M-RET}. Furthermore, you can compose a message for
|
|||
the contact at point by either @key{[mouse-2]} or pressing @key{C}. If you
|
||||
always want to see the addresses, you can set
|
||||
@option{mu4e-view-show-addresses} to @t{t}.
|
||||
@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.}
|
||||
@item The body text can be line-wrapped using @t{longlines-mode}. @t{mu4e}
|
||||
defines @key{w} to toggle between the wrapped and unwrapped state. If you want
|
||||
to do this for every message, invoke @code{longlines-mode} in your
|
||||
@code{mu4e-view-mode-hook}.
|
||||
@item You can hide cited parts in messages (the parts starting with @t{ > })
|
||||
using @code{mu4e-view-hide-cited}, bound to @key{h}. If you want to do this
|
||||
automatically for every message, invoke the function in your
|
||||
@code{mu4e-view-mode-hook}.
|
||||
|
||||
@item For search-related operations, see @ref{Searching}.
|
||||
@end itemize
|
||||
|
||||
|
|
Loading…
Reference in New Issue