unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch.el patch for older emacs
@ 2010-02-09 21:33 James Vasile
  2010-02-28  1:34 ` [PATCH] compatibility with emacs22 James Vasile
  0 siblings, 1 reply; 4+ messages in thread
From: James Vasile @ 2010-02-09 21:33 UTC (permalink / raw)
  To: notmuch

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)

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

* [PATCH] compatibility with emacs22
  2010-02-09 21:33 notmuch.el patch for older emacs James Vasile
@ 2010-02-28  1:34 ` James Vasile
  2010-11-16 23:07   ` Carl Worth
  0 siblings, 1 reply; 4+ messages in thread
From: James Vasile @ 2010-02-28  1:34 UTC (permalink / raw)
  To: notmuch


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

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

* Re: [PATCH] compatibility with emacs22
  2010-02-28  1:34 ` [PATCH] compatibility with emacs22 James Vasile
@ 2010-11-16 23:07   ` Carl Worth
  2010-11-16 23:48     ` Rob Browning
  0 siblings, 1 reply; 4+ messages in thread
From: Carl Worth @ 2010-11-16 23:07 UTC (permalink / raw)
  To: James Vasile, notmuch

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Sat, 27 Feb 2010 20:34:45 -0500, James Vasile <james@hackervisions.org> wrote:
> 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.

Hi James.

Thanks very much for the patch. I've pushed this now, (and apologize
that I let it languish for so long!).

In the meantime, we've switched the emacs interface to parse JSON,
requring json.el which ships in emacs 23 but not earlier. But perhaps
getting access to that single, entire file will be easier than getting
access to these two little functions.

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] compatibility with emacs22
  2010-11-16 23:07   ` Carl Worth
@ 2010-11-16 23:48     ` Rob Browning
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Browning @ 2010-11-16 23:48 UTC (permalink / raw)
  To: Carl Worth; +Cc: notmuch

Carl Worth <cworth@cworth.org> writes:

> But perhaps getting access to that single, entire file will be easier
> than getting access to these two little functions.

Assuming the current emacs-23 version will work:

  wget -O json.el \
    'http://repo.or.cz/w/emacs.git/blob_plain/emacs-23:/lisp/json.el'

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

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

end of thread, other threads:[~2010-11-16 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-09 21:33 notmuch.el patch for older emacs James Vasile
2010-02-28  1:34 ` [PATCH] compatibility with emacs22 James Vasile
2010-11-16 23:07   ` Carl Worth
2010-11-16 23:48     ` Rob Browning

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).