[notmuch] notmuch.el patch for older emacs

James Vasile james at hackervisions.org
Tue Feb 9 13:33:14 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



diff --git a/notmuch.el b/notmuch.el
index 97914f2..03b17f6 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -51,6 +51,21 @@
 (require 'mm-view)
 (require 'message)
 
+;; Old emacs lacks apply-partially and mouse-event-p
+(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)


More information about the notmuch mailing list