Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a2 / 2cddaa847c59470e053d96823bd56928920960
1 Return-Path: <Sebastian@SSpaeth.de>\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 2408A4196F0\r
6         for <notmuch@notmuchmail.org>; Mon,  3 May 2010 02:45:10 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id psgH8llX7B-P for <notmuch@notmuchmail.org>;\r
16         Mon,  3 May 2010 02:45:08 -0700 (PDT)\r
17 Received: from homiemail-a15.g.dreamhost.com (caiajhbdccah.dreamhost.com\r
18         [208.97.132.207])\r
19         by olra.theworths.org (Postfix) with ESMTP id CC522431FC1\r
20         for <notmuch@notmuchmail.org>; Mon,  3 May 2010 02:45:08 -0700 (PDT)\r
21 Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
22         [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de)\r
23         by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPA id 9F83776C062; \r
24         Mon,  3 May 2010 02:45:02 -0700 (PDT)\r
25 From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
26 To: Notmuch developer list <notmuch@notmuchmail.org>\r
27 Subject: [PATCH] Make notmuch-hello a mode.\r
28 Date: Mon,  3 May 2010 11:45:00 +0200\r
29 Message-Id: <1272879900-8285-1-git-send-email-Sebastian@SSpaeth.de>\r
30 X-Mailer: git-send-email 1.7.0.4\r
31 X-BeenThere: notmuch@notmuchmail.org\r
32 X-Mailman-Version: 2.1.13\r
33 Precedence: list\r
34 List-Id: "Use and development of the notmuch mail system."\r
35         <notmuch.notmuchmail.org>\r
36 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
37         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
39 List-Post: <mailto:notmuch@notmuchmail.org>\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
41 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
43 X-List-Received-Date: Mon, 03 May 2010 09:45:10 -0000\r
44 \r
45 This enables the nifty '?' key binding to work in notmuch-hello\r
46 (although for some strange reasons I don't see any descriptions for\r
47 specific key bindings yet. Not sure how that is supposed to work\r
48 though.\r
49 But this starts, runs and behaves identical to the existing code.\r
50 \r
51 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
52 ---\r
53 I am not sure this is ready to be commited as is. But it enables the \r
54 '?' key binding and behaves as previously. Perhaps there can be made\r
55 some further tweaks as to where to set the buffer read-only now and stuff.\r
56 \r
57 Is this something we could build on? I really enjoy my '?' keybinding.\r
58 \r
59  emacs/notmuch-hello.el |   37 ++++++++++++++++++++++++++++---------\r
60  1 files changed, 28 insertions(+), 9 deletions(-)\r
61 \r
62 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
63 index 6a1c56e..5746fd2 100644\r
64 --- a/emacs/notmuch-hello.el\r
65 +++ b/emacs/notmuch-hello.el\r
66 @@ -213,6 +213,31 @@ diagonal."\r
67    (notmuch-poll)\r
68    (notmuch-hello-update))\r
69  \r
70 +\r
71 +(defvar notmuch-hello-mode-map\r
72 +  (let ((map (copy-keymap widget-keymap)))\r
73 +    (define-key map "?" 'notmuch-help)\r
74 +    (define-key map "=" 'notmuch-hello-update)\r
75 +    (define-key map "G" 'notmuch-hello-poll-and-update)\r
76 +    (define-key map "m" 'notmuch-mua-mail)\r
77 +    (define-key map "q" 'kill-this-buffer)\r
78 +    (define-key map "s" 'notmuch-hello-goto-search)\r
79 +    (define-key map "v" '(lambda () (interactive)\r
80 +                           (message "notmuch version %s" (notmuch-version))))\r
81 +    map)\r
82 +  "Keymap for \"notmuch hello\" buffers.")\r
83 +(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)\r
84 +\r
85 +(defun notmuch-hello-mode ()\r
86 + "Major mode for conventient notmuch navigation"\r
87 + (interactive)\r
88 + (kill-all-local-variables)\r
89 + (use-local-map notmuch-hello-mode-map)\r
90 + (setq major-mode 'notmuch-hello-mode\r
91 +       mode-name "notmuch-hello")\r
92 + ;;(setq buffer-read-only t)\r
93 +)\r
94 +\r
95  (defun notmuch-hello (&optional no-display)\r
96    (interactive)\r
97  \r
98 @@ -237,6 +262,9 @@ diagonal."\r
99      (let ((inhibit-read-only t))\r
100        (erase-buffer))\r
101  \r
102 +    (unless (eq major-mode 'notmuch-hello-mode)\r
103 +      (notmuch-hello-mode))\r
104 +\r
105      (let ((all (overlay-lists)))\r
106        ;; Delete all the overlays.\r
107        (mapc 'delete-overlay (car all))\r
108 @@ -397,15 +425,6 @@ diagonal."\r
109         (let ((fill-column (- (window-width) notmuch-hello-indent)))\r
110           (center-region start (point))))\r
111  \r
112 -      (use-local-map widget-keymap)\r
113 -      (local-set-key "=" 'notmuch-hello-update)\r
114 -      (local-set-key "G" 'notmuch-hello-poll-and-update)\r
115 -      (local-set-key "m" 'notmuch-mua-mail)\r
116 -      (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))\r
117 -      (local-set-key "s" 'notmuch-hello-goto-search)\r
118 -      (local-set-key "v" '(lambda () (interactive)\r
119 -                           (message "notmuch version %s" (notmuch-version))))\r
120 -\r
121        (widget-setup)\r
122  \r
123        (goto-char final-target-pos)\r
124 -- \r
125 1.7.0.4\r
126 \r