From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EBLDKRRBqF8dPAAA0tVLHw (envelope-from ) for ; Sun, 08 Nov 2020 19:03:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 8FWZJRRBqF9KagAA1q6Kng (envelope-from ) for ; Sun, 08 Nov 2020 19:03:48 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 25B249402C8 for ; Sun, 8 Nov 2020 19:03:48 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BB5FE28BF4; Sun, 8 Nov 2020 14:03:26 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8AB73270DC for ; Sun, 8 Nov 2020 14:03:13 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 8D4F416645 for ; Sun, 8 Nov 2020 20:03:12 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id DJ2CBq_uQb64 for ; Sun, 8 Nov 2020 20:03:12 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 20704165EB for ; Sun, 8 Nov 2020 20:03:12 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH 08/27] emacs: more cleanup since dropping support for Emacs 24 Date: Sun, 8 Nov 2020 20:02:52 +0100 Message-Id: <20201108190311.1397-9-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201108190311.1397-1-jonas@bernoul.li> References: <20201108190311.1397-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: TGYLSMC5FVEX7I437XCD6CFN3UWWFBQK X-Message-ID-Hash: TGYLSMC5FVEX7I437XCD6CFN3UWWFBQK X-MailFrom: jonas@bernoul.li X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: yVLib4Jr9Jau 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'. --- emacs/notmuch-compat.el | 9 +++++---- emacs/notmuch-hello.el | 16 +++++----------- emacs/notmuch-jump.el | 5 ----- emacs/notmuch-lib.el | 12 ------------ emacs/notmuch-mua.el | 17 ++++++----------- emacs/notmuch-show.el | 10 ++++------ emacs/notmuch-tree.el | 7 ++++--- 7 files changed, 24 insertions(+), 52 deletions(-) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index 3ede6b36..2975f4c2 100644 --- a/emacs/notmuch-compat.el +++ b/emacs/notmuch-compat.el @@ -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) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index b67a5e19..af170dd4 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -645,6 +645,7 @@ (defun notmuch-hello-window-configuration-change () ;; 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 @@ (defun notmuch-hello-versions () " (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 "") 'widget-backward) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 1e2d0497..ff622055 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -29,11 +29,6 @@ (eval-when-compile (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. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 118faf1e..edb40533 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -653,18 +653,6 @@ (defun notmuch-get-bodypart-text (msg part process-crypto &optional cache) 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." diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 869ec51a..49bad00d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -47,8 +47,7 @@ (defcustom notmuch-mua-send-hook nil :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 @@ (defcustom notmuch-mua-compose-in 'current-window 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 @@ (defun notmuch-mua-reply-crypto (parts) "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 @@ (defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all 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 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ec22fd94..6a757687 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -186,8 +186,7 @@ (defvar notmuch-show-attachment-debug nil 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 @@ (defun notmuch-show-apply-to-current-part-handle (fn &optional mime-type) 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*") diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ad08f7c6..28c9372e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -531,9 +531,10 @@ (defun notmuch-tree-message-window-kill-hook () (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))))) -- 2.29.1