mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
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:
parent
1acaaa093c
commit
ff80122972
7 changed files with 24 additions and 52 deletions
|
@ -21,10 +21,11 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;; emacs master has a bugfix for folding long headers when sending
|
;; Before Emacs 26.1 lines that are longer than 998 octets were not.
|
||||||
;; messages. Include the fix for earlier versions of emacs. To avoid
|
;; folded. Commit 77bbca8c82f6e553c42abbfafca28f55fc995d00 fixed
|
||||||
;; interfering with gnus we only run the hook when called from
|
;; that. Until we drop support for Emacs 25 we have to backport that
|
||||||
;; notmuch-message-mode.
|
;; 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)
|
(declare-function mail-header-fold-field "mail-parse" nil)
|
||||||
|
|
||||||
|
|
|
@ -645,6 +645,7 @@ with `notmuch-hello-query-counts'."
|
||||||
;; Refresh hello as soon as we get back to redisplay. On Emacs
|
;; Refresh hello as soon as we get back to redisplay. On Emacs
|
||||||
;; 24, we can't do it right here because something in this
|
;; 24, we can't do it right here because something in this
|
||||||
;; hook's call stack overrides hello's point placement.
|
;; 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))
|
(run-at-time nil nil #'notmuch-hello t))
|
||||||
(unless hello-buf
|
(unless hello-buf
|
||||||
;; Clean up hook
|
;; Clean up hook
|
||||||
|
@ -665,17 +666,10 @@ with `notmuch-hello-query-counts'."
|
||||||
" (emacs mua version " notmuch-emacs-version ")")))))
|
" (emacs mua version " notmuch-emacs-version ")")))))
|
||||||
|
|
||||||
(defvar notmuch-hello-mode-map
|
(defvar notmuch-hello-mode-map
|
||||||
(let ((map (if (fboundp 'make-composed-keymap)
|
;; Inherit both widget-keymap and notmuch-common-keymap. We have
|
||||||
;; Inherit both widget-keymap and
|
;; to use make-sparse-keymap to force this to be a new keymap (so
|
||||||
;; notmuch-common-keymap. We have to use
|
;; that when we modify map it does not modify widget-keymap).
|
||||||
;; make-sparse-keymap to force this to be a new
|
(let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap))))
|
||||||
;; 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))))
|
|
||||||
(set-keymap-parent map notmuch-common-keymap)
|
(set-keymap-parent map notmuch-common-keymap)
|
||||||
(define-key map "v" 'notmuch-hello-versions)
|
(define-key map "v" 'notmuch-hello-versions)
|
||||||
(define-key map (kbd "<C-tab>") 'widget-backward)
|
(define-key map (kbd "<C-tab>") 'widget-backward)
|
||||||
|
|
|
@ -29,11 +29,6 @@
|
||||||
(require 'notmuch-lib)
|
(require 'notmuch-lib)
|
||||||
(require 'notmuch-hello)
|
(require 'notmuch-hello)
|
||||||
|
|
||||||
(eval-and-compile
|
|
||||||
(unless (fboundp 'window-body-width)
|
|
||||||
;; Compatibility for Emacs pre-24
|
|
||||||
(defalias 'window-body-width 'window-width)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun notmuch-jump-search ()
|
(defun notmuch-jump-search ()
|
||||||
"Jump to a saved search by shortcut key.
|
"Jump to a saved search by shortcut key.
|
||||||
|
|
|
@ -653,18 +653,6 @@ If CACHE is non-nil, the content of this part will be saved in
|
||||||
MSG (if it isn't already)."
|
MSG (if it isn't already)."
|
||||||
(notmuch--get-bodypart-raw msg part process-crypto nil cache))
|
(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)
|
(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
|
"Use the mm-decode/mm-view functions to display a part in the
|
||||||
current buffer, if possible."
|
current buffer, if possible."
|
||||||
|
|
|
@ -47,8 +47,7 @@
|
||||||
:group 'notmuch-hooks)
|
:group 'notmuch-hooks)
|
||||||
|
|
||||||
(defcustom notmuch-mua-compose-in 'current-window
|
(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
|
Possible values are `current-window' (default), `new-window' and
|
||||||
`new-frame'. If set to `current-window', the mail buffer will be
|
`new-frame'. If set to `current-window', the mail buffer will be
|
||||||
displayed in the current window, so the old 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.
|
window/frame that will be destroyed when the buffer is killed.
|
||||||
You may want to customize `message-kill-buffer-on-exit'
|
You may want to customize `message-kill-buffer-on-exit'
|
||||||
accordingly."
|
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
|
:group 'notmuch-send
|
||||||
:type '(choice (const :tag "Compose in the current window" current-window)
|
:type '(choice (const :tag "Compose in the current window" current-window)
|
||||||
(const :tag "Compose mail in a new window" new-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/*")
|
"multipart/*")
|
||||||
do (notmuch-mua-reply-crypto (plist-get part :content))))
|
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
|
;; not being inserted after the References header, so the next header
|
||||||
;; is concatenated to the end of it. This function fixes the problem,
|
;; is concatenated to the end of it. This function fixes the problem,
|
||||||
;; while guarding against the possibility that some current or future
|
;; 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
|
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
|
the From: address first. If REPLY-ALL is non-nil, the message
|
||||||
will be addressed to all recipients of the source message."
|
will be addressed to all recipients of the source message."
|
||||||
;; In current emacs (24.3) select-active-regions is set to t by
|
;; `select-active-regions' is t by default. The reply insertion code
|
||||||
;; default. The reply insertion code sets the region to the quoted
|
;; sets the region to the quoted message to make it easy to delete
|
||||||
;; message to make it easy to delete (kill-region or C-w). These two
|
;; (kill-region or C-w). These two things combine to put the quoted
|
||||||
;; things combine to put the quoted message in the primary selection.
|
;; message in the primary selection.
|
||||||
;;
|
;;
|
||||||
;; This is not what the user wanted and is a privacy risk (accidental
|
;; 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
|
;; pasting of the quoted message). We can avoid some of the problems
|
||||||
|
|
|
@ -186,8 +186,7 @@ indentation."
|
||||||
When set to nil (the default) stdout and stderr from attachment
|
When set to nil (the default) stdout and stderr from attachment
|
||||||
handlers is discarded. When set to t the stdout and stderr from
|
handlers is discarded. When set to t the stdout and stderr from
|
||||||
each attachment handler is logged in buffers with names beginning
|
each attachment handler is logged in buffers with names beginning
|
||||||
\" *notmuch-part*\". This option requires emacs version at least
|
\" *notmuch-part*\".")
|
||||||
24.3 to work.")
|
|
||||||
|
|
||||||
(defcustom notmuch-show-stash-mlarchive-link-alist
|
(defcustom notmuch-show-stash-mlarchive-link-alist
|
||||||
'(("Gmane" . "https://mid.gmane.org/")
|
'(("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
|
is destroyed when FN returns. If MIME-TYPE is given then force
|
||||||
part to be treated as if it had that mime-type."
|
part to be treated as if it had that mime-type."
|
||||||
(let ((handle (notmuch-show-current-part-handle mime-type)))
|
(let ((handle (notmuch-show-current-part-handle mime-type)))
|
||||||
;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
|
;; Emacs puts stdout/stderr into the calling buffer so we call
|
||||||
;; call it from a temp-buffer, unless
|
;; it from a temp-buffer, unless notmuch-show-attachment-debug
|
||||||
;; notmuch-show-attachment-debug is non-nil in which case we put
|
;; is non-nil, in which case we put it in " *notmuch-part*".
|
||||||
;; it in " *notmuch-part*".
|
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(if notmuch-show-attachment-debug
|
(if notmuch-show-attachment-debug
|
||||||
(with-current-buffer (generate-new-buffer " *notmuch-part*")
|
(with-current-buffer (generate-new-buffer " *notmuch-part*")
|
||||||
|
|
|
@ -531,9 +531,10 @@ NOT change the database."
|
||||||
(let ((buffer (current-buffer)))
|
(let ((buffer (current-buffer)))
|
||||||
(when (and (window-live-p notmuch-tree-message-window)
|
(when (and (window-live-p notmuch-tree-message-window)
|
||||||
(eq (window-buffer notmuch-tree-message-window) buffer))
|
(eq (window-buffer notmuch-tree-message-window) buffer))
|
||||||
;; We do not want an error if this is the sole window in the
|
;; We could check whether this is the only window in its frame,
|
||||||
;; frame and I do not know how to test for that in emacs pre
|
;; but simply ignoring the error that is thrown otherwise is
|
||||||
;; 24. Hence we just ignore-errors.
|
;; what we had to do for Emacs 24 and we stick to that because
|
||||||
|
;; it is still the simplest approach.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(delete-window notmuch-tree-message-window)))))
|
(delete-window notmuch-tree-message-window)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue