Some of the recent changes to the emacs code have used functions
introduced in emacs 24. The functions used are read-char-choice and
setq-local. This changeset adds compatability functions to
notmuch-lib so that it should work on emacs 23.

---

Hi

I tried compiling under emacs 23 recently and noticed that some recent
changes have used some features introuduced in emacs 24. I think we
still support emacs 23 so this changeset adds two compatability
functions.

They are setq-local, which is esentially trivial, and
read-char-choice. I have written a minimal version of read-char-choice
for the functionality we need -- an alternative would be to just copy
and paste the function from emacs 24 source.

I have tested (lightly) on emacs 23 and it seems to work (and didn't
before). It should not change anything on more recent emacs (i.e. in
cases where we weren't already broken).

Finally, it does leave a compiler warning when compiling under emacs
23: notmuch-company.el does not require notmuch-lib.el but I think
that is probably OK.

Best wishes

Mark



emacs/notmuch-lib.el | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 1f0d167..1459f83 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -966,6 +966,24 @@ status."
 (defvar notmuch-show-process-crypto nil)
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 
+;; Compatability functions for emacs 23.
+
+(unless (fboundp 'setq-local)
+  (defmacro setq-local (var val)
+    `(set (make-local-variable ',var) ,val)))
+
+(unless (fboundp 'read-char-choice)
+  (defun read-char-choice (prompt chars)
+    (let (char done)
+      (while (not done)
+       (setq char (read-key prompt))
+       (cond
+        ((memq char chars)
+         (setq done t))
+        ((memq char '(?\C-g ?\e))
+         (keyboard-quit))))
+      char)))
+
 (provide 'notmuch-lib)
 
 ;; Local Variables:
-- 
2.1.4

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to