unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: add compatability functions for emacs 23
@ 2016-10-23  3:03 Mark Walters
  2016-10-25 21:32 ` David Bremner
  2016-10-27  4:28 ` Matt Armstrong
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Walters @ 2016-10-23  3:03 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-27 17:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-23  3:03 [PATCH] emacs: add compatability functions for emacs 23 Mark Walters
2016-10-25 21:32 ` David Bremner
2016-10-25 21:53   ` Mark Walters
2016-10-27  4:28 ` Matt Armstrong
2016-10-27  9:38   ` Mark Walters
2016-10-27 11:18     ` David Bremner
2016-10-27 17:02       ` Matt Armstrong

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).