From 616282c4ad5a7249901bf4c47de9dff40770af9e Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 8 Jun 2023 18:51:22 +0300 Subject: [PATCH] mu4e: add mu4e-listp for backward compat The listp function was only added to emacs 29. Fixes #2499. --- mu4e/mu4e-helpers.el | 7 +++++++ mu4e/mu4e-lists.el | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-helpers.el b/mu4e/mu4e-helpers.el index 67608c1f..c4ab627d 100644 --- a/mu4e/mu4e-helpers.el +++ b/mu4e/mu4e-helpers.el @@ -578,6 +578,13 @@ Mu4e version of emacs 28's string-replace." (replace-regexp-in-string (regexp-quote from-string) to-string in-string nil 'literal)) +(defun mu4e-plistp (object) + "Non-nil if and only if OBJECT is a valid plist. + +This is mu4e's version of Emacs 29's `plistp'." + (let ((len (proper-list-p object))) + (and len (zerop (% len 2))))) + (defun mu4e-key-description (cmd) "Get the textual form of current binding to interactive function CMD. If it is unbound, return nil. If there are multiple bindings, diff --git a/mu4e/mu4e-lists.el b/mu4e/mu4e-lists.el index a5ecc028..ff50c32a 100644 --- a/mu4e/mu4e-lists.el +++ b/mu4e/mu4e-lists.el @@ -27,7 +27,7 @@ ;;; Code: (require 'mu4e-message) - +(require 'mu4e-helpers) ;;; Helpers @@ -127,7 +127,7 @@ Based on the current value of `mu4e-mailing-lists' and (interactive) (setq mu4e--lists-hash (make-hash-table :test 'equal)) (seq-do (lambda (item) - (if (plistp item) + (if (mu4e-plistp item) ;; the new format (puthash (plist-get item :list-id) item mu4e--lists-hash) ;; backward compatibility