[notmuch] [PATCH] compatibility with emacs22

James Vasile james at hackervisions.org
Sat Feb 27 17:34:45 PST 2010


Emacs22 lacks apply-partially and mouse-event-p, so define them if emacs
version is less than 23.  With this change, I was able to begin using
notmuch in emacs22.

apply-partially cribbed from http://notmuchmail.org/pipermail/notmuch/2009/000889.html

This is an updated patch that fixes a bug in the last version.
---
 notmuch.el |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5577dde..20e82f1 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -67,6 +67,21 @@
 
 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
 
+;; Old emacs lacks apply-partially
+(when (< emacs-major-version 23)
+  (defun apply-partially (fun &rest args)
+  "Return a function that is a partial application of FUN to ARGS.
+ARGS is a list of the first N arguments to pass to FUN.
+The result is a new function which does the same as FUN, except that
+the first N arguments are fixed at the values with which this function
+was called."
+  (lexical-let ((fun fun) (args1 args))
+    (lambda (&rest args2) (apply fun (append args1 args2)))))
+
+  (defun mouse-event-p (object)
+  "Return non-nil if OBJECT is a mouse click event."
+  (memq (event-basic-type object) '(mouse-1 mouse-2 mouse-3 mouse-movement))))
+
 (defvar notmuch-show-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "?" 'notmuch-help)
-- 
1.6.3.3


More information about the notmuch mailing list