Re: bug#6214: 23.1; json-read-string crashes emacs with long string
[notmuch-archives.git] / 6e / 1fbea13e34d236780cb34c77131f38001e483e
1 Return-Path: <james@hackervisions.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id AD3F4431FBC\r
6         for <notmuch@notmuchmail.org>; Tue,  9 Feb 2010 20:07:55 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.715\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.715 tagged_above=-999 required=5\r
12         tests=[AWL=-1.885, BAYES_50=0.001, DATE_IN_PAST_06_12=1.069,\r
13         RDNS_DYNAMIC=0.1] autolearn=no\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id K4pVcDWzv7Sv for <notmuch@notmuchmail.org>;\r
17         Tue,  9 Feb 2010 20:07:55 -0800 (PST)\r
18 X-Greylist: delayed 1466 seconds by postgrey-1.32 at olra;\r
19         Tue, 09 Feb 2010 20:07:55 PST\r
20 Received: from hackervisions.org (67-207-143-141.slicehost.net\r
21         [67.207.143.141])\r
22         by olra.theworths.org (Postfix) with ESMTP id 4E241431FAE\r
23         for <notmuch@notmuchmail.org>; Tue,  9 Feb 2010 20:07:55 -0800 (PST)\r
24 Received: from ool-18bd392a.dyn.optonline.net ([24.189.57.42]\r
25         helo=wyzanski.hackervisions.org)\r
26         by hv with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69)\r
27         (envelope-from <james@hackervisions.org>)\r
28         id 1Nf3U9-0005oF-8E; Tue, 09 Feb 2010 22:43:29 -0500\r
29 Date: Tue, 09 Feb 2010 16:33:14 -0500\r
30 Message-ID: <878wb2qelh.wl%james@hackervisions.org>\r
31 From: James Vasile <james@hackervisions.org>\r
32 To: notmuch@notmuchmail.org\r
33 X-Mailer: Wanderlust/2.15.6\r
34 User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=)\r
35         APEL/10.7 Emacs/23.1.50 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)\r
36 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")\r
37 Content-Type: text/plain; charset=US-ASCII\r
38 X-Mailman-Approved-At: Wed, 10 Feb 2010 09:45:27 -0800\r
39 Subject: [notmuch] notmuch.el patch for older emacs\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Wed, 10 Feb 2010 04:07:55 -0000\r
53 \r
54 Emacs22 lacks apply-partially and mouse-event-p, so define them if\r
55 emacs version is less than 23.  With this change, I was able to begin\r
56 using notmuch in emacs22.\r
57 \r
58 apply-partially cribbed from http://notmuchmail.org/pipermail/notmuch/2009/000889.html\r
59 \r
60 \r
61 \r
62 diff --git a/notmuch.el b/notmuch.el\r
63 index 97914f2..03b17f6 100644\r
64 --- a/notmuch.el\r
65 +++ b/notmuch.el\r
66 @@ -51,6 +51,21 @@\r
67  (require 'mm-view)\r
68  (require 'message)\r
69  \r
70 +;; Old emacs lacks apply-partially and mouse-event-p\r
71 +(when (<= emacs-major-version 23)\r
72 +  (defun apply-partially (fun &rest args)\r
73 +  "Return a function that is a partial application of FUN to ARGS.\r
74 +ARGS is a list of the first N arguments to pass to FUN.\r
75 +The result is a new function which does the same as FUN, except that\r
76 +the first N arguments are fixed at the values with which this function\r
77 +was called."\r
78 +  (lexical-let ((fun fun) (args1 args))\r
79 +    (lambda (&rest args2) (apply fun (append args1 args2)))))\r
80 +\r
81 +  (defun mouse-event-p (object)\r
82 +  "Return non-nil if OBJECT is a mouse click event."\r
83 +  (memq (event-basic-type object) '(mouse-1 mouse-2 mouse-3 mouse-movement))))\r
84 +\r
85  (defvar notmuch-show-mode-map\r
86    (let ((map (make-sparse-keymap)))\r
87      (define-key map "?" 'notmuch-help)\r