mirror of https://github.com/djcb/mu.git
mu4e: Replace mu4e-view-use-gnus with mu4e-view-use-old
Make mu4e-view-use-gnus obsolete (it's the default now), and add a variable mu4e-view-use-old (which must be set before starting mu4e). Update documentation / mentions. Load the correct view when starting mu4e, so people can customize e.g. the keymap. Add some sanity checking.
This commit is contained in:
parent
342df5a3ed
commit
2437dc27c9
15
NEWS.org
15
NEWS.org
|
@ -39,16 +39,21 @@
|
|||
*** mu4e
|
||||
|
||||
- Use the gnus-based message viewer as the default; the new viewer has quite
|
||||
a few features compared to the old, mu4e-specific one, such as faster
|
||||
crypto, support for S/MIME, syntax-highlighting, calendar invitations and
|
||||
more.
|
||||
a few extra features compared to the old, mu4e-specific one, such as
|
||||
faster crypto, support for S/MIME, syntax-highlighting, calendar
|
||||
invitations and more.
|
||||
|
||||
It does not do everything the old viewer does though (e.g., attachment
|
||||
actions), so if you depend on those, you can use:
|
||||
actions), so if you depend on those:
|
||||
#+begin_example
|
||||
(setq mu4e-view-use-gnus nil)
|
||||
;; set *before* loading mu4e; and restart emacs if you want to change it
|
||||
;; users of use-packag~ should can use the :init section for this.
|
||||
(setq mu4e-view-use-old t)
|
||||
#+end_example
|
||||
|
||||
(The older variable ~mu4e-view-use-gnus~ with the opposite meaning is
|
||||
obsolete now, and no longer in use).
|
||||
|
||||
- Include maildir-shortcuts in the main-view with overall/unread counts,
|
||||
similar to bookmarks, and with the same ~:hide~ and ~:hide-unread~ properties.
|
||||
Note that for the latter, you need to update your maildir-shortcuts to the
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; mu4e-contrib.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2013-2020 Dirk-Jan C. Binnema
|
||||
;; Copyright (C) 2013-2021 Dirk-Jan C. Binnema
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -1749,7 +1749,7 @@ _not_ refresh the last search with the new setting for threading."
|
|||
|
||||
(defun mu4e~decrypt-p (msg)
|
||||
"Should we decrypt this message?"
|
||||
(unless mu4e-view-use-gnus ;; we don't decrypt in the gnus-view case
|
||||
(when mu4e-view-use-old ;; we don't decrypt in the gnus-view case
|
||||
(and (member 'encrypted (mu4e-message-field msg :flags))
|
||||
(if (eq mu4e-decryption-policy 'ask)
|
||||
(yes-or-no-p (mu4e-format "Decrypt message?"))
|
||||
|
@ -1773,7 +1773,7 @@ window . "
|
|||
(funcall mu4e-view-auto-mark-as-read msg)
|
||||
mu4e-view-auto-mark-as-read))
|
||||
(decrypt (mu4e~decrypt-p msg))
|
||||
(verify (not mu4e-view-use-gnus))
|
||||
(verify mu4e-view-use-old)
|
||||
(viewwin (mu4e~headers-redraw-get-view-window)))
|
||||
(unless (window-live-p viewwin)
|
||||
(mu4e-error "Cannot get a message view"))
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
(require 'mu4e-view)
|
||||
(require 'mu4e-vars)
|
||||
|
||||
(when mu4e-view-use-old
|
||||
(mu4e-error "iCalender support is not available with the old viewer"))
|
||||
|
||||
;;;###autoload
|
||||
(defun mu4e-icalendar-setup ()
|
||||
"Perform the necessary initialization to use mu4e-icalendar."
|
||||
|
|
|
@ -856,9 +856,9 @@ When successful, call FUNC (if non-nil) afterwards."
|
|||
;; kill all mu4e buffers
|
||||
(mapc
|
||||
(lambda (buf)
|
||||
;; When using mu4e-view-use-gnus, the view buffer has the kill-buffer-hook
|
||||
;; function mu4e~view-kill-buffer-hook-fn which kills the mm-* buffers
|
||||
;; created by Gnus' article mode. Those have been returned by
|
||||
;; When using the Gnus-based viewer, the view buffer has the
|
||||
;; kill-buffer-hook function mu4e~view-kill-buffer-hook-fn which kills the
|
||||
;; mm-* buffers created by Gnus' article mode. Those have been returned by
|
||||
;; `buffer-list' but might already be deleted in case the view buffer has
|
||||
;; been killed first. So we need a `buffer-live-p' check here.
|
||||
(when (buffer-live-p buf)
|
||||
|
|
|
@ -69,12 +69,13 @@ Setting this to t increases the amount of information in the log."
|
|||
"Settings for the message view."
|
||||
:group 'mu4e)
|
||||
|
||||
(defcustom mu4e-view-use-gnus t
|
||||
"If non-nil, use the new Gnus-based viewer.
|
||||
Otherwise, use the old viewer."
|
||||
(defcustom mu4e-view-use-old nil
|
||||
"If non-nil, use the old viewer.
|
||||
Otherwise, use the new, Gnus-based viewer."
|
||||
:type 'boolean
|
||||
:group 'mu4e-view)
|
||||
|
||||
(make-obsolete-variable 'mu4e-view-use-gnus 'mu4e-view-use-old "1.5.10")
|
||||
|
||||
(defcustom mu4e-speedbar-support nil
|
||||
"Support having a speedbar to navigate folders/bookmarks."
|
||||
|
@ -421,7 +422,7 @@ The setting is a symbol:
|
|||
* `ask': ask before decrypting anything
|
||||
* nil: don't try to decrypt anything.
|
||||
|
||||
Note that this is not used when `mu4e-view-use-gnus' is enabled."
|
||||
Note that this is not used unless `mu4e-view-use-old' is enabled."
|
||||
:type '(choice (const :tag "Try to decrypt automatically" t)
|
||||
(const :tag "Ask before decrypting anything" ask)
|
||||
(const :tag "Don't try to decrypt anything" nil))
|
||||
|
@ -1019,10 +1020,9 @@ property, which should point to a function that takes a message
|
|||
plist as argument, and returns a string. See the default value of
|
||||
`mu4e-header-info-custom for an example.
|
||||
|
||||
Note that when using the gnus-based view (see
|
||||
`mu4e-view-use-gnus'), you only have access to a limited set of
|
||||
message fields: only the ones used in the header-view, not
|
||||
including, for instance, the message body.")
|
||||
Note that when using the gnus-based view, you only have access to
|
||||
a limited set of message fields: only the ones used in the
|
||||
header-view, not including, for instance, the message body.")
|
||||
|
||||
;;; Run-time variables / constants
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
(declare-function mu4e-error "mu4e-utils")
|
||||
|
||||
(require 'mu4e-view-common)
|
||||
(require (if mu4e-view-use-old 'mu4e-view-old 'mu4e-view-gnus))
|
||||
|
||||
(defun mu4e-view (msg)
|
||||
"Display the message MSG in a new buffer, and keep in sync with HDRSBUF.
|
||||
|
@ -42,23 +43,21 @@ the the message view affects HDRSBUF, as does marking etc.
|
|||
As a side-effect, a message that is being viewed loses its 'unread'
|
||||
marking if it still had that.
|
||||
|
||||
Depending on the value of `mu4e-view-use-gnus', either use mu4e's
|
||||
internal display mode, or a display mode based on Gnus'
|
||||
article-mode."
|
||||
Depending on the value of `mu4e-view-use-old', either use mu4e's
|
||||
internal display mode, or a (by default) display mode based on
|
||||
Gnus' article-mode."
|
||||
|
||||
;; sanity checks.
|
||||
(if (and mu4e-view-use-old (featurep 'mu4e-view-gnus))
|
||||
(error "Cannot use old view when gnus-view is loaded; restart emacs")
|
||||
(if (and (not mu4e-view-use-old) (featurep 'mu4e-view-old))
|
||||
(error "Cannot use gnus-based view with old view loaded; restart emacs")))
|
||||
|
||||
(mu4e~headers-update-handler msg nil nil);; update headers, if necessary.
|
||||
|
||||
;; sanity check; only one can be active.
|
||||
(if mu4e-view-use-gnus
|
||||
(progn
|
||||
(when (featurep 'mu4e-view-old)
|
||||
(mu4e-error "Cannot load gnus-based view with old one loaded. Restart emacs"))
|
||||
(require 'mu4e-view-gnus)
|
||||
(mu4e~view-gnus msg))
|
||||
(progn
|
||||
(when (featurep 'mu4e-view-gnus)
|
||||
(mu4e-error "Cannot load old view with gnus-based view loaded. Restart emacs"))
|
||||
(require 'mu4e-view-old)
|
||||
(mu4e~view-old msg))))
|
||||
(if mu4e-view-use-old
|
||||
(mu4e~view-old msg)
|
||||
(mu4e~view-gnus msg)))
|
||||
|
||||
(defun mu4e-view-message-with-message-id (msgid)
|
||||
"View message with message-id MSGID. This (re)creates a
|
||||
|
|
|
@ -1329,7 +1329,6 @@ q leave the message view
|
|||
|
||||
For the marking commands, please refer to @ref{Marking messages}.
|
||||
|
||||
|
||||
@node MSGV Custom headers
|
||||
@section Custom headers
|
||||
|
||||
|
@ -1361,11 +1360,18 @@ Since version 1.6 @t{mu4e} defaults to the new, Gnus-based, message view.
|
|||
|
||||
However, the older view is still available, and this chapter is about
|
||||
that one. While we recommend using the default one, you can still use
|
||||
the old one by configuring it:
|
||||
the old one by configuring it @emph{before} @t{require}'ing @t{mu4e}:
|
||||
@lisp
|
||||
(setq mu4e-view-use-gnus nil)
|
||||
(setq mu4e-view-use-old t)
|
||||
@end lisp
|
||||
|
||||
Users of
|
||||
@t{use-package}@footnote{@url{https://jwiegley.github.io/use-package/}}
|
||||
can use the @t{:init} section for this.
|
||||
|
||||
If you want to change this, you need to fully restart @t{mu4e} (in
|
||||
practice, this means you need to restart @t{emacs}.
|
||||
|
||||
After selecting a message in the @ref{Headers view}, it appears in a message
|
||||
view window, which shows the message headers, followed by the message
|
||||
body. Its major mode is @code{mu4e-view-mode}.
|
||||
|
@ -3805,13 +3811,8 @@ Now, you can bind a convenient key to my-mu4e-bookmarks/body.
|
|||
By default, mu4e presents iCalendar invitations as .vcs file
|
||||
attachments. Experimental support is available to parse these
|
||||
attachments in order to add the expected ``Accept'', ``Reject'', ``Add
|
||||
to Calendar'' buttons. This requires using Gnus' article view, instead
|
||||
of mu4e's internal viewer. We do this by setting the value of
|
||||
mu4e-view-use-gnus:
|
||||
|
||||
@lisp
|
||||
(setq mu4e-view-use-gnus t)
|
||||
@end lisp
|
||||
to Calendar'' buttons. This requires using Gnus' article view, which
|
||||
is the default since @t{mu4e} version 1.6.
|
||||
|
||||
The minimal setup is:
|
||||
|
||||
|
@ -3838,22 +3839,6 @@ To enable optional functionality to capture iCalendar events to your org files:
|
|||
NOTE: both the capture file and the headline(s) inside must already
|
||||
exist.
|
||||
|
||||
These features require the Gnus article viewer. This is currently
|
||||
experimental, and doesn't yet support all the features available with
|
||||
mu4e's internal viewer. Consequently, you may want a way to toggle
|
||||
between the two modes. You can do this with the following:
|
||||
|
||||
@lisp
|
||||
(defun mu4e-toggle-gnus-view ()
|
||||
(interactive)
|
||||
(mu4e~view-quit-buffer)
|
||||
(setq mu4e-view-use-gnus
|
||||
(not mu4e-view-use-gnus))
|
||||
(mu4e-headers-view-message))
|
||||
|
||||
(define-key mu4e-view-mode-map "i" 'mu4e-toggle-gnus-view)
|
||||
@end lisp
|
||||
|
||||
@node Example configs
|
||||
@appendix Example configs
|
||||
|
||||
|
|
Loading…
Reference in New Issue