From 008529696af1cbc3a56d14534de5cf3a38f7486f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 25 May 2026 22:06:15 +0300 Subject: [PATCH] mu4e: remove emacs < 28.1 shims We can depend on more functions now, so can get rid of our own versions. --- mu4e/mu4e-compose.el | 3 --- mu4e/mu4e-contrib.el | 18 ++---------------- mu4e/mu4e-draft.el | 3 +-- mu4e/mu4e-headers.el | 9 ++------- mu4e/mu4e-helpers.el | 5 ++--- mu4e/mu4e-message.el | 4 +--- mu4e/mu4e-vars.el | 3 +-- mu4e/mu4e-window.el | 12 +----------- 8 files changed, 10 insertions(+), 47 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index c1ec8d66..70cd0711 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -268,9 +268,6 @@ buffers; lets remap its faces so it uses the ones for mu4e." (define-key map (kbd "C-c C-u") #'mu4e-update-mail-and-index) (define-key map (kbd "C-c ;") #'mu4e-compose-context-switch) - ;; emacs 29 - ;;(keymap-set map " " #'mu4e-compose-goto-top) - ;;(keymap-set map " " #'mu4e-compose-goto-bottom) (define-key map (vector 'remap #'beginning-of-buffer) #'mu4e-compose-goto-top) (define-key map (vector 'remap #'end-of-buffer) diff --git a/mu4e/mu4e-contrib.el b/mu4e/mu4e-contrib.el index d7630641..7fa2f5c9 100644 --- a/mu4e/mu4e-contrib.el +++ b/mu4e/mu4e-contrib.el @@ -132,20 +132,6 @@ For example for bogofile, use \"/usr/bin/bogofilter -Sn < %s\"") -;; backward compat until 27.1 is univeral. -(defalias 'mu4e--flatten-list - (if (fboundp 'flatten-list) - #'flatten-list - (with-no-warnings - #'eshell-flatten-list))) - -;; backward compat ntil 28.1 is universal. -(defalias 'mu4e--mm-default-file-type - (if (fboundp 'mm-default-file-type) - #'mm-default-file-type - (with-no-warnings - #'mm-default-file-encoding))) - (defun eshell/mu4e-attach (&rest args) "Attach files to a mu4e message using eshell with ARGS. If no mu4e buffers found, compose a new message and then attach @@ -159,7 +145,7 @@ the file." (lambda (f) (when (and (file-exists-p f) (not (file-directory-p f))) (expand-file-name f))) - (mu4e--flatten-list (reverse args))))) + (flatten-list (reverse args))))) ;; warn if user tries to attach without any files marked (if (null files-to-attach) (error "No files to attach") @@ -188,7 +174,7 @@ the file." (goto-char (point-max)) ; attach at end of buffer (while files-to-attach (mml-attach-file (car files-to-attach) - (or (mu4e--mm-default-file-type + (or (mm-default-file-type (car files-to-attach)) "application/octet-stream") nil) (setq files-to-attach (cdr files-to-attach))) diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 4c2d93a3..ff6221bc 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -254,8 +254,7 @@ It looks something like This filename is used for the draft message and the sent message, depending on `mu4e-sent-messages-behavior'." - (let* ((sysname (if (fboundp 'system-name) - (system-name) (with-no-warnings system-name))) + (let* ((sysname (system-name)) (sysname (if (string= sysname "") "localhost" sysname)) (hostname (downcase (save-match-data diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index dc3b8c04..828b5e1f 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -1189,13 +1189,8 @@ The following specs are supported: ;; Eldoc support (when (and (featurep 'eldoc) mu4e-eldoc-support) - (if (boundp 'eldoc-documentation-functions) - ;; Emacs 28 or newer - (add-hook 'eldoc-documentation-functions - #'mu4e-headers-eldoc-function nil t) - ;; Emacs 27 or older - (add-function :before-until (local 'eldoc-documentation-function) - #'mu4e-headers-eldoc-function))) + (add-hook 'eldoc-documentation-functions + #'mu4e-headers-eldoc-function nil t)) ;; support bookmarks. (setq-local bookmark-make-record-function diff --git a/mu4e/mu4e-helpers.el b/mu4e/mu4e-helpers.el index 7ccca16b..8060d518 100644 --- a/mu4e/mu4e-helpers.el +++ b/mu4e/mu4e-helpers.el @@ -359,9 +359,8 @@ Function returns the value (cdr) of the matching cell." (unless (get-buffer mu4e--log-buffer-name) (with-current-buffer (get-buffer-create mu4e--log-buffer-name) (view-mode) - (when (fboundp 'so-long-mode) - (unless (eq major-mode 'so-long-mode) - (eval '(so-long-mode)))) + (unless (eq major-mode 'so-long-mode) + (so-long-mode)) (setq buffer-undo-list t))) mu4e--log-buffer-name) diff --git a/mu4e/mu4e-message.el b/mu4e/mu4e-message.el index 819b28f6..90cdc721 100644 --- a/mu4e/mu4e-message.el +++ b/mu4e/mu4e-message.el @@ -249,9 +249,7 @@ Returns the full path." (kill-buffer mu4e--sexp-buffer-name)) (with-current-buffer-window (get-buffer-create mu4e--sexp-buffer-name) nil nil - (if (fboundp 'lisp-data-mode) - (lisp-data-mode) - (lisp-mode)) + (lisp-data-mode) (insert (pp-to-string msg)) (font-lock-ensure) ;; add basic `quit-window' bindings diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index f3cd2537..d9795d85 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -128,8 +128,7 @@ I.e. a message with the draft flag set." :group 'mu4e-faces) (defface mu4e-header-highlight-face - `((t :inherit hl-line :weight bold :underline t - ,@(and (>= emacs-major-version 27) '(:extend t)))) + '((t :inherit hl-line :weight bold :underline t :extend t)) "Face for the header at point." :group 'mu4e-faces) diff --git a/mu4e/mu4e-window.el b/mu4e/mu4e-window.el index aa9407ef..02b75406 100644 --- a/mu4e/mu4e-window.el +++ b/mu4e/mu4e-window.el @@ -191,16 +191,6 @@ buffer's major mode." (eq (mu4e--get-current-buffer-type) type)) -;; backward-compat; buffer-local-boundp was introduced in emacs 28. -(defun mu4e--buffer-local-boundp (symbol buffer) - "Return non-nil if SYMBOL is bound in BUFFER. -Also see `local-variable-p'." - (condition-case nil - (buffer-local-value symbol buffer) - (:success t) - (void-variable nil))) - - (defun mu4e-get-view-buffer (&optional headers-buffer create) "Return a view buffer belonging optionally to HEADERS-BUFFER. @@ -229,7 +219,7 @@ being created if CREATE is non-nil." (linked-buffer (mu4e-get-view-buffers (lambda (buf) - (and (mu4e--buffer-local-boundp 'mu4e-linked-headers-buffer buf) + (and (buffer-local-boundp 'mu4e-linked-headers-buffer buf) (eq mu4e-linked-headers-buffer headers-buffer)))))) ;; If such a linked buffer exists and its buffer is live, we use that ;; buffer.