emacs: more cleanup since dropping support for Emacs 24

Notmuch requires at least version 25 of Emacs now.

Adjust comments that previously referenced version 24 specifically,
even though they also apply to later releases. Remove documentation
and code that no longer applies.

- `mm-shr' no longer references `gnus-inhibit-images'.
This commit is contained in:
Jonas Bernoulli 2020-11-16 22:28:24 +01:00 committed by David Bremner
parent 1acaaa093c
commit ff80122972
7 changed files with 24 additions and 52 deletions

View file

@ -21,10 +21,11 @@
;;; Code:
;; emacs master has a bugfix for folding long headers when sending
;; messages. Include the fix for earlier versions of emacs. To avoid
;; interfering with gnus we only run the hook when called from
;; notmuch-message-mode.
;; Before Emacs 26.1 lines that are longer than 998 octets were not.
;; folded. Commit 77bbca8c82f6e553c42abbfafca28f55fc995d00 fixed
;; that. Until we drop support for Emacs 25 we have to backport that
;; fix. To avoid interfering with Gnus we only run the hook when
;; called from notmuch-message-mode.
(declare-function mail-header-fold-field "mail-parse" nil)

View file

@ -645,6 +645,7 @@ with `notmuch-hello-query-counts'."
;; Refresh hello as soon as we get back to redisplay. On Emacs
;; 24, we can't do it right here because something in this
;; hook's call stack overrides hello's point placement.
;; FIXME And on Emacs releases that we still support?
(run-at-time nil nil #'notmuch-hello t))
(unless hello-buf
;; Clean up hook
@ -665,17 +666,10 @@ with `notmuch-hello-query-counts'."
" (emacs mua version " notmuch-emacs-version ")")))))
(defvar notmuch-hello-mode-map
(let ((map (if (fboundp 'make-composed-keymap)
;; Inherit both widget-keymap and
;; notmuch-common-keymap. We have to use
;; make-sparse-keymap to force this to be a new
;; keymap (so that when we modify map it does not
;; modify widget-keymap).
(make-composed-keymap (list (make-sparse-keymap) widget-keymap))
;; Before Emacs 24, keymaps didn't support multiple
;; inheritance,, so just copy the widget keymap since
;; it's unlikely to change.
(copy-keymap widget-keymap))))
;; Inherit both widget-keymap and notmuch-common-keymap. We have
;; to use make-sparse-keymap to force this to be a new keymap (so
;; that when we modify map it does not modify widget-keymap).
(let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap))))
(set-keymap-parent map notmuch-common-keymap)
(define-key map "v" 'notmuch-hello-versions)
(define-key map (kbd "<C-tab>") 'widget-backward)

View file

@ -29,11 +29,6 @@
(require 'notmuch-lib)
(require 'notmuch-hello)
(eval-and-compile
(unless (fboundp 'window-body-width)
;; Compatibility for Emacs pre-24
(defalias 'window-body-width 'window-width)))
;;;###autoload
(defun notmuch-jump-search ()
"Jump to a saved search by shortcut key.

View file

@ -653,18 +653,6 @@ If CACHE is non-nil, the content of this part will be saved in
MSG (if it isn't already)."
(notmuch--get-bodypart-raw msg part process-crypto nil cache))
;; Workaround: The call to `mm-display-part' below triggers a bug in
;; Emacs 24 if it attempts to use the shr renderer to display an HTML
;; part with images in it (demonstrated in 24.1 and 24.2 on Debian and
;; Fedora 17, though unreproducible in other configurations).
;; `mm-shr' references the variable `gnus-inhibit-images' without
;; first loading gnus-art, which defines it, resulting in a
;; void-variable error. Hence, we advise `mm-shr' to ensure gnus-art
;; is loaded.
(define-advice mm-shr (:before (_handle) notmuch--load-gnus-args)
"Require `gnus-art' since we use its variables."
(require 'gnus-art nil t))
(defun notmuch-mm-display-part-inline (msg part content-type process-crypto)
"Use the mm-decode/mm-view functions to display a part in the
current buffer, if possible."

View file

@ -47,8 +47,7 @@
:group 'notmuch-hooks)
(defcustom notmuch-mua-compose-in 'current-window
(concat
"Where to create the mail buffer used to compose a new message.
"Where to create the mail buffer used to compose a new message.
Possible values are `current-window' (default), `new-window' and
`new-frame'. If set to `current-window', the mail buffer will be
displayed in the current window, so the old buffer will be
@ -57,10 +56,6 @@ or `new-frame', the mail buffer will be displayed in a new
window/frame that will be destroyed when the buffer is killed.
You may want to customize `message-kill-buffer-on-exit'
accordingly."
(when (< emacs-major-version 24)
" Due to a known bug in Emacs 23, you should not set
this to `new-window' if `message-kill-buffer-on-exit' is
disabled: this would result in an incorrect behavior."))
:group 'notmuch-send
:type '(choice (const :tag "Compose in the current window" current-window)
(const :tag "Compose mail in a new window" new-window)
@ -212,7 +207,7 @@ Typically this is added to `notmuch-mua-send-hook'."
"multipart/*")
do (notmuch-mua-reply-crypto (plist-get part :content))))
;; There is a bug in emacs 23's message.el that results in a newline
;; There is a bug in Emacs' message.el that results in a newline
;; not being inserted after the References header, so the next header
;; is concatenated to the end of it. This function fixes the problem,
;; while guarding against the possibility that some current or future
@ -517,10 +512,10 @@ the From: address."
If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
the From: address first. If REPLY-ALL is non-nil, the message
will be addressed to all recipients of the source message."
;; In current emacs (24.3) select-active-regions is set to t by
;; default. The reply insertion code sets the region to the quoted
;; message to make it easy to delete (kill-region or C-w). These two
;; things combine to put the quoted message in the primary selection.
;; `select-active-regions' is t by default. The reply insertion code
;; sets the region to the quoted message to make it easy to delete
;; (kill-region or C-w). These two things combine to put the quoted
;; message in the primary selection.
;;
;; This is not what the user wanted and is a privacy risk (accidental
;; pasting of the quoted message). We can avoid some of the problems

View file

@ -186,8 +186,7 @@ indentation."
When set to nil (the default) stdout and stderr from attachment
handlers is discarded. When set to t the stdout and stderr from
each attachment handler is logged in buffers with names beginning
\" *notmuch-part*\". This option requires emacs version at least
24.3 to work.")
\" *notmuch-part*\".")
(defcustom notmuch-show-stash-mlarchive-link-alist
'(("Gmane" . "https://mid.gmane.org/")
@ -2417,10 +2416,9 @@ This ensures that the temporary buffer created for the mm-handle
is destroyed when FN returns. If MIME-TYPE is given then force
part to be treated as if it had that mime-type."
(let ((handle (notmuch-show-current-part-handle mime-type)))
;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
;; call it from a temp-buffer, unless
;; notmuch-show-attachment-debug is non-nil in which case we put
;; it in " *notmuch-part*".
;; Emacs puts stdout/stderr into the calling buffer so we call
;; it from a temp-buffer, unless notmuch-show-attachment-debug
;; is non-nil, in which case we put it in " *notmuch-part*".
(unwind-protect
(if notmuch-show-attachment-debug
(with-current-buffer (generate-new-buffer " *notmuch-part*")

View file

@ -531,9 +531,10 @@ NOT change the database."
(let ((buffer (current-buffer)))
(when (and (window-live-p notmuch-tree-message-window)
(eq (window-buffer notmuch-tree-message-window) buffer))
;; We do not want an error if this is the sole window in the
;; frame and I do not know how to test for that in emacs pre
;; 24. Hence we just ignore-errors.
;; We could check whether this is the only window in its frame,
;; but simply ignoring the error that is thrown otherwise is
;; what we had to do for Emacs 24 and we stick to that because
;; it is still the simplest approach.
(ignore-errors
(delete-window notmuch-tree-message-window)))))