unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
@ 2010-04-12 10:13 David Edmondson
  2010-04-13  4:58 ` Xavier Maillard
  2010-04-13 10:25 ` Michal Sojka
  0 siblings, 2 replies; 15+ messages in thread
From: David Edmondson @ 2010-04-12 10:13 UTC (permalink / raw
  To: notmuch

commit e55dc251b9e8001fe16873fadac565563e606d69
Author: David Edmondson <dme@dme.org>
Date:   Mon Apr 12 11:12:23 2010 +0100

    emacs: Add notmuch-hello.el, a friendly frontend to notmuch

	New      emacs/notmuch-hello.el
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
new file mode 100644
index 0000000..279c424
--- /dev/null
+++ b/emacs/notmuch-hello.el
@@ -0,0 +1,122 @@
+;; notmuch-hello.el --- welcome to notmuch, a frontend
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: David Edmondson <dme@dme.org>
+
+(require 'widget)
+
+(require 'notmuch-lib)
+
+(defvar notmuch-hello-searches-to-save 10)
+(defvar notmuch-hello-search-width 60)
+
+(defvar notmuch-hello-recent-searches nil)
+
+(defun notmuch-hello-save-search (search)
+  (if (not (memq search notmuch-hello-recent-searches))
+      (push search notmuch-hello-recent-searches))
+  (if (> (length notmuch-hello-recent-searches)
+	 notmuch-hello-searches-to-save)
+      (setq notmuch-hello-recent-searches (butlast notmuch-hello-recent-searches))))
+
+(defun notmuch-hello-trim (search)
+  "Trim whitespace."
+  (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
+      (match-string 1 search)
+    search))
+
+(defun notmuch-hello-search (search)
+  (let ((search (notmuch-hello-trim search)))
+    (notmuch-hello-save-search search)
+    (notmuch-search search)))
+
+(defun notmuch-hello ()
+  (interactive)
+
+  (switch-to-buffer "*notmuch-hello*")
+  (kill-all-local-variables)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+
+  (let ((all (overlay-lists)))
+    ;; Delete all the overlays.
+    (mapcar 'delete-overlay (car all))
+    (mapcar 'delete-overlay (cdr all)))
+
+  (widget-insert "\nWelcome to notmuch.\n\n")
+  (let ((start (point)))
+    (widget-insert "Search: ")
+    (widget-create 'editable-field
+		   :size notmuch-hello-search-width
+		   :action (lambda (widget &rest ignore)
+			     (let ((search (widget-value widget)))
+			       (notmuch-hello-search search))))
+    (widget-insert "\n")
+    (indent-rigidly start (point) 4))
+
+  (when notmuch-hello-recent-searches
+    (widget-insert "\nRecent searches:\n\n")
+    (let ((start (point)))
+      (mapcar '(lambda (search)
+		 (widget-create 'editable-field
+				:size notmuch-hello-search-width
+				:action (lambda (widget &rest ignore)
+					  (let ((search (widget-value widget)))
+					    (notmuch-hello-search search)))
+				search)
+		 (widget-insert "\n"))
+	      notmuch-hello-recent-searches)
+      (indent-rigidly start (point) 4)))
+
+  (widget-insert "\nFolders:\n\n")
+  (let ((start (point)))
+    (mapcar '(lambda (folder)
+	       (let ((w (widget-create 'push-button
+				       :notify (lambda (widget &rest ignore)
+						 (notmuch-search (widget-get widget :notmuch-search-terms)))
+				       "open")))
+		 (widget-put w :notmuch-search-terms (cdr folder)))
+	       (widget-insert (format " %6s %s\n" (notmuch-folder-count (cdr folder)) (car folder))))
+	    notmuch-folders)
+    (indent-rigidly start (point) 4))
+
+  (widget-insert "\nAll tags:\n\n")
+  (let ((start (point)))
+    (mapcar '(lambda (tag)
+	       (let ((w (widget-create 'push-button
+				       :notify (lambda (widget &rest ignore)
+						 (notmuch-search (widget-get widget :notmuch-search-terms)))
+				       "open")))
+		 (widget-put w :notmuch-search-terms (concat "tag:" tag)))
+	       (widget-insert (format " %6s %s\n" (notmuch-folder-count
+						   (concat "tag:" tag))
+				      tag)))
+	    (process-lines notmuch-command "search-tags"))
+    (indent-rigidly start (point) 4))
+
+  (use-local-map widget-keymap)
+  (local-set-key "=" 'notmuch-hello)
+  (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
+
+  (widget-setup)
+
+  ;; Always put point inside the `search' widget, which we know is
+  ;; first.
+  (goto-char (point-min))
+  (widget-forward 1))


dme.
-- 
David Edmondson, http://dme.org

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-12 10:13 [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
@ 2010-04-13  4:58 ` Xavier Maillard
  2010-04-13  6:54   ` David Edmondson
  2010-04-13 10:25 ` Michal Sojka
  1 sibling, 1 reply; 15+ messages in thread
From: Xavier Maillard @ 2010-04-13  4:58 UTC (permalink / raw
  To: David Edmondson, notmuch

On Mon, 12 Apr 2010 11:13:30 +0100, David Edmondson <dme@dme.org> wrote:
> commit e55dc251b9e8001fe16873fadac565563e606d69
> Author: David Edmondson <dme@dme.org>
> Date:   Mon Apr 12 11:12:23 2010 +0100
> 
>     emacs: Add notmuch-hello.el, a friendly frontend to notmuch

I like it !

Xavier

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-13  4:58 ` Xavier Maillard
@ 2010-04-13  6:54   ` David Edmondson
  0 siblings, 0 replies; 15+ messages in thread
From: David Edmondson @ 2010-04-13  6:54 UTC (permalink / raw
  To: Xavier Maillard, notmuch

On Tue, 13 Apr 2010 06:58:46 +0200, Xavier Maillard <xma@gnu.org> wrote:
> On Mon, 12 Apr 2010 11:13:30 +0100, David Edmondson <dme@dme.org> wrote:
> > commit e55dc251b9e8001fe16873fadac565563e606d69
> > Author: David Edmondson <dme@dme.org>
> > Date:   Mon Apr 12 11:12:23 2010 +0100
> > 
> >     emacs: Add notmuch-hello.el, a friendly frontend to notmuch
> 
> I like it !

There's an updated version in the `dme-play' branch of
git://github.com/dme/notmuch.git.

dme.
-- 
David Edmondson, http://dme.org

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-12 10:13 [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
  2010-04-13  4:58 ` Xavier Maillard
@ 2010-04-13 10:25 ` Michal Sojka
  2010-04-13 10:33   ` David Edmondson
  1 sibling, 1 reply; 15+ messages in thread
From: Michal Sojka @ 2010-04-13 10:25 UTC (permalink / raw
  To: David Edmondson, notmuch

On Mon, 12 Apr 2010, David Edmondson wrote:
> commit e55dc251b9e8001fe16873fadac565563e606d69
> Author: David Edmondson <dme@dme.org>
> Date:   Mon Apr 12 11:12:23 2010 +0100
> 
>     emacs: Add notmuch-hello.el, a friendly frontend to notmuch

Hi dme,

thanks for the great patch. For next time, could you plese use 'git
format-patch' for generating patches for sending in email? If I pipe
your message to 'git am', all the above text becomes a part of commit
message.

-Michal

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-13 10:25 ` Michal Sojka
@ 2010-04-13 10:33   ` David Edmondson
  0 siblings, 0 replies; 15+ messages in thread
From: David Edmondson @ 2010-04-13 10:33 UTC (permalink / raw
  To: Michal Sojka, notmuch

On Tue, 13 Apr 2010 12:25:43 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> For next time, could you plese use 'git format-patch' for generating
> patches for sending in email? If I pipe your message to 'git am', all
> the above text becomes a part of commit message.

Will do.

dme.
-- 
David Edmondson, http://dme.org

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

* [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-22  1:11 Update on 0.3 progress Carl Worth
@ 2010-04-22  8:27 ` David Edmondson
  2010-04-23 20:13   ` Carl Worth
  0 siblings, 1 reply; 15+ messages in thread
From: David Edmondson @ 2010-04-22  8:27 UTC (permalink / raw
  To: notmuch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 20566 bytes --]

---
 emacs/Makefile.local   |    5 +
 emacs/notmuch-hello.el |  359 ++++++++++++++++++++++++++++++++++++++++++++++++
 emacs/notmuch-lib.el   |    9 ++
 emacs/notmuch-logo.png |  Bin 0 -> 1671 bytes
 emacs/notmuch.el       |   28 +++--
 5 files changed, 390 insertions(+), 11 deletions(-)
 create mode 100644 emacs/notmuch-hello.el
 create mode 100644 emacs/notmuch-logo.png

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..6486d90 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -7,6 +7,10 @@ emacs_sources := \
 	$(dir)/notmuch-query.el \
 	$(dir)/notmuch-show.el \
 	$(dir)/notmuch-wash.el
+	$(dir)/notmuch-hello.el
+
+emacs_images := \
+	$(dir)/notmuch-logo.png
 
 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
 
@@ -26,5 +30,6 @@ install-emacs:
 ifeq ($(HAVE_EMACS),1)
 	install -m0644 $(emacs_bytecode) $(DESTDIR)$(emacslispdir)
 endif
+	install -m0644 $(emacs_images) $(DESTDIR)$(emacslispdir)
 
 CLEAN := $(CLEAN) $(emacs_bytecode)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
new file mode 100644
index 0000000..13de6f8
--- /dev/null
+++ b/emacs/notmuch-hello.el
@@ -0,0 +1,359 @@
+;; notmuch-hello.el --- welcome to notmuch, a frontend
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: David Edmondson <dme@dme.org>
+
+(require 'widget)
+(require 'wid-edit) ; For `widget-forward'.
+(require 'cl)
+
+(require 'notmuch-lib)
+(require 'notmuch)
+
+(declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line))
+(declare-function notmuch-folder-count "notmuch" (search))
+
+(defcustom notmuch-hello-recent-searches-max 10
+  "The number of recent searches to store and display."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-empty-saved-searches nil
+  "Should saved searches with no messages be listed?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-indent 4
+  "How much to indent non-headers."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-saved-searches notmuch-folders
+  "A list of saved searches to display."
+  :type '(alist :key-type string :value-type string)
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-logo t
+  "Should the notmuch logo be shown?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-logo-background "#5f5f5f"
+  "Background colour for the notmuch logo."
+  :type 'color
+  :group 'notmuch)
+
+(defcustom notmuch-hello-jump-to-search nil
+  "Whether `notmuch-hello' should always jump to the search
+field."
+  :type 'boolean
+  :group 'notmuch)
+
+(defvar notmuch-hello-url "http://notmuchmail.org"
+  "The `notmuch' web site.")
+
+(defvar notmuch-hello-recent-searches nil)
+
+(defun notmuch-hello-remember-search (search)
+  (if (not (memq search notmuch-hello-recent-searches))
+      (push search notmuch-hello-recent-searches))
+  (if (> (length notmuch-hello-recent-searches)
+	 notmuch-hello-recent-searches-max)
+      (setq notmuch-hello-recent-searches (butlast notmuch-hello-recent-searches))))
+
+(defun notmuch-hello-trim (search)
+  "Trim whitespace."
+  (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
+      (match-string 1 search)
+    search))
+
+(defun notmuch-hello-search (search)
+  (let ((search (notmuch-hello-trim search)))
+    (notmuch-hello-remember-search search)
+    (notmuch-search search notmuch-search-oldest-first nil nil #'notmuch-hello-search-continuation)))
+
+(defun notmuch-hello-add-saved-search (widget)
+  (interactive)
+  (let ((search (widget-value
+		 (symbol-value
+		  (widget-get widget :notmuch-saved-search-widget))))
+	(name (completing-read "Name for saved search: "
+			       notmuch-hello-saved-searches)))
+    ;; If an existing saved search with this name exists, remove it.
+    (setq notmuch-hello-saved-searches
+	  (loop for elem in notmuch-hello-saved-searches
+		if (not (equal name
+			       (car elem)))
+		collect elem))
+    ;; Add the new one.
+    (customize-save-variable 'notmuch-hello-saved-searches
+			     (push (cons name search)
+				   notmuch-hello-saved-searches))
+    (message "Saved '%s' as '%s'." search name)
+    (notmuch-hello-update)))
+
+(defun notmuch-hello-longest-label (tag-alist)
+  (or (loop for elem in tag-alist
+	    maximize (length (car elem)))
+      0))
+
+(defun notmuch-hello-roundup (dividend divisor)
+  "Return the rounded up value of dividing `dividend' by `divisor'."
+  (+ (/ dividend divisor)
+     (if (> (% dividend divisor) 0) 1 0)))
+
+(defun notmuch-hello-reflect (list width)
+  "Reflect a `width' wide matrix represented by `list' along the
+diagonal."
+  ;; Not very lispy...
+  (let* ((len (length list))
+	 (nrows (notmuch-hello-roundup len width)))
+    (loop for row from 0 to (- nrows 1)
+	  append (loop for col from 0 to (- width 1)
+		       ;; How could we calculate the offset just once
+		       ;; per inner-loop?
+		       if (< (+ (* nrows col) row) len)
+		       collect (nth (+ (* nrows col) row) list)
+		       else
+		       ;; Don't forget to insert an empty slot in the
+		       ;; output matrix if there is no corresponding
+		       ;; value in the input matrix.
+		       collect nil))))
+
+(defun notmuch-hello-widget-search (widget &rest ignore)
+  (notmuch-search (widget-get widget
+			      :notmuch-search-terms)
+		  notmuch-search-oldest-first
+		  nil nil #'notmuch-hello-search-continuation))
+
+(defun notmuch-hello-insert-tags (tag-alist widest)
+  (let* ((tag-format-string (format "%%-%ds " widest))
+	 (tags-per-line (max 1
+			     (/ (- (window-width) notmuch-hello-indent)
+				;; Count is 7 wide, 1 for the space
+				;; after the name.
+				(+ 7 1 widest))))
+	 (count 0)
+	 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
+	 ;; Hack the display of the buttons used.
+	 (widget-push-button-prefix "")
+	 (widget-push-button-suffix ""))
+    ;; dme: It feels as though there should be a better way to
+    ;; implement this loop than using an incrementing counter.
+    (loop for elem in reordered-list
+	  do (progn
+	       ;; (not elem) indicates an empty slot in the matrix.
+	       (when elem
+		 (widget-insert (format "%6s " (notmuch-folder-count (cdr elem))))
+		 (widget-create 'push-button
+				:notify #'notmuch-hello-widget-search
+				:notmuch-search-terms (cdr elem)
+				(format tag-format-string (car elem))))
+	       (setq count (1+ count))
+	       (if (eq (% count tags-per-line) 0)
+		   (widget-insert "\n"))))
+
+    ;; If the last line was not full (and hence did not include a
+    ;; carriage return), insert one now.
+    (if (not (eq (% count tags-per-line) 0))
+	(widget-insert "\n"))))
+
+(defun notmuch-hello-goto-search ()
+  "Put point inside the `search' widget, which we know is first."
+  (interactive)
+  (goto-char (point-min))
+  (widget-forward 3))
+
+(defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
+
+(defun notmuch-hello-search-continuation()
+  (notmuch-hello t))
+
+(defun notmuch-hello-update (&optional no-display)
+  ;; Lazy - rebuild everything.
+  (interactive)
+  (notmuch-hello no-display))
+
+(defun notmuch-hello (&optional no-display)
+  (interactive)
+
+  (if no-display
+      (set-buffer "*notmuch-hello*")
+    (switch-to-buffer "*notmuch-hello*"))
+
+  (kill-all-local-variables)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+
+  (let ((all (overlay-lists)))
+    ;; Delete all the overlays.
+    (mapc 'delete-overlay (car all))
+    (mapc 'delete-overlay (cdr all)))
+
+  (when notmuch-hello-show-logo
+    (let ((image notmuch-hello-logo))
+      ;; dme: Sorry, I don't know any other way to achieve this :-( The
+      ;; notmuch logo uses transparency. That works out badly when
+      ;; inserting the image into an emacs buffer, so force the
+      ;; background colour of the image.
+      (setq image (cons 'image (append (cdr image)
+				       `(:background ,notmuch-hello-logo-background))))
+      (insert-image image))
+    (widget-insert "  "))
+
+  (widget-insert "Welcome to ")
+  ;; Hack the display of the links used.
+  (let ((widget-link-prefix "")
+	(widget-link-suffix ""))
+    (widget-create 'link
+		   :notify (lambda (&rest ignore)
+			     (browse-url notmuch-hello-url))
+		   :help-echo "Visit the notmuch website."
+		   "notmuch")
+    (widget-insert ". ")
+    (widget-insert "You have ")
+    (widget-create 'link
+		   :notify (lambda (&rest ignore)
+			     (notmuch-hello-update))
+		   :help-echo "Refresh"
+		   (car (process-lines notmuch-command "count")))
+    (widget-insert " messages (that's not much mail).\n\n"))
+
+  (let ((start (point)))
+    (widget-insert "Search: ")
+    (widget-create 'editable-field
+		   ;; Leave some space at the start and end of the
+		   ;; search boxes.
+		   :size (max 8 (- (window-width) (* 2 notmuch-hello-indent)
+				   (length "Search: ")))
+		   :action (lambda (widget &rest ignore)
+			     (notmuch-hello-search (widget-value widget))))
+    (widget-insert "\n")
+    (indent-rigidly start (point) notmuch-hello-indent))
+
+  (when notmuch-hello-recent-searches
+    (widget-insert "\nRecent searches: ")
+    (widget-create 'push-button
+		   :notify (lambda (&rest ignore)
+			     (setq notmuch-hello-recent-searches nil)
+			     (notmuch-hello-update))
+		   "clear")
+    (widget-insert "\n\n")
+    (let ((start (point))
+	  (key 0))
+      (mapc '(lambda (search)
+	       (widget-insert (format "%2d: " key))
+	       (let ((widget-symbol (intern (format "notmuch-hello-search-%d" key))))
+		 (set widget-symbol
+		      (widget-create 'editable-field
+				     ;; Leave some space at the start
+				     ;; and end of the search boxes. 4
+				     ;; for the accelerator key. 1 for
+				     ;; the space before the `save'
+				     ;; button. 6 for the `save'
+				     ;; button.
+				     :size (max 8 (- (window-width) (* 2 notmuch-hello-indent)
+						     4 1 6))
+				     :action (lambda (widget &rest ignore)
+					       (notmuch-hello-search (widget-value widget)))
+				     search))
+		 (widget-insert " ")
+		 (widget-create 'push-button
+				:notify (lambda (widget &rest ignore)
+					  (notmuch-hello-add-saved-search widget))
+				:notmuch-saved-search-widget widget-symbol
+				"save"))
+	       (widget-insert "\n")
+	       (setq key (1+ key)))
+	    notmuch-hello-recent-searches)
+      (indent-rigidly start (point) notmuch-hello-indent)))
+
+  (let* ((saved-alist
+	  ;; Filter out empty saved seaches if required.
+	  (if notmuch-hello-show-empty-saved-searches
+	      notmuch-hello-saved-searches
+	    (loop for elem in notmuch-hello-saved-searches
+		  if (> (string-to-number (notmuch-folder-count (cdr elem))) 0)
+		  collect elem)))
+	 (saved-widest (notmuch-hello-longest-label saved-alist))
+	 (alltags-alist (mapcar '(lambda (tag) (cons tag (concat "tag:" tag)))
+				(process-lines notmuch-command "search-tags")))
+	 (alltags-widest (notmuch-hello-longest-label alltags-alist))
+	 (widest (max saved-widest alltags-widest)))
+
+    (when saved-alist
+      (widget-insert "\nSaved searches: ")
+      (widget-create 'push-button
+		     :notify (lambda (&rest ignore)
+			       (customize-variable 'notmuch-hello-saved-searches))
+		     "edit")
+      (widget-insert "\n\n")
+      (let ((start (point)))
+	(notmuch-hello-insert-tags saved-alist widest)
+	(indent-rigidly start (point) notmuch-hello-indent)))
+
+    (when alltags-alist
+      (widget-insert "\nAll tags:\n\n")
+      (let ((start (point)))
+	(notmuch-hello-insert-tags alltags-alist widest)
+	(indent-rigidly start (point) notmuch-hello-indent))))
+
+  (let ((start (point)))
+    (widget-insert "\n\n")
+    (widget-insert "Type a search query and hit RET to view matching threads.\n")
+    (when notmuch-hello-recent-searches
+      (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n")
+      (let ((searches (length notmuch-hello-recent-searches)))
+	(widget-insert
+	 (if (eq 1 searches)
+	     "Key 0 acts as an accelerator for the previous query.\n"
+	   (format "Keys 0-%d act as accelerators for the previous queries.\n"
+		   (- searches 1)))))
+      (widget-insert "Save recent searches with the `save' button.\n"))
+    (when notmuch-hello-saved-searches
+      (widget-insert "Edit saved searches with the `edit' button.\n"))
+    (widget-insert "Hit RET or click on a saved search or tag name to view matching threads.\n")
+    (widget-insert "`=' refreshes this screen. `s' jumps to the search box. `q' to quit.\n")
+    (let ((fill-column (- (window-width) notmuch-hello-indent)))
+      (center-region start (point))))
+
+  (use-local-map widget-keymap)
+  (local-set-key "=" 'notmuch-hello-update)
+  (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
+  (local-set-key "s" 'notmuch-hello-goto-search)
+  (local-set-key "v" '(lambda () (interactive)
+			(message "notmuch version %s" (notmuch-version))))
+
+  (loop for key from 0 to (- (length notmuch-hello-recent-searches) 1)
+	do (let ((widget-symbol (intern (format "notmuch-hello-search-%d" key))))
+	     (local-set-key (number-to-string key)
+			    `(lambda ()
+			       (interactive)
+			       (notmuch-search (widget-value ,widget-symbol)
+					       notmuch-search-oldest-first
+					       nil nil #'notmuch-hello-search-continuation)))))
+  (widget-setup)
+
+  (if notmuch-hello-jump-to-search
+      (notmuch-hello-goto-search)
+    (goto-char (point-min))))
+
+;;
+
+(provide 'notmuch-hello)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index cb9be30..274d7ec 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -24,6 +24,15 @@
 (defvar notmuch-command "notmuch"
   "Command to run the notmuch binary.")
 
+(defgroup notmuch nil
+  "Notmuch mail reader for Emacs."
+  :group 'mail)
+
+(defcustom notmuch-folders '(("inbox" . "tag:inbox") ("unread" . "tag:unread"))
+  "List of searches for the notmuch folder view"
+  :type '(alist :key-type (string) :value-type (string))
+  :group 'notmuch)
+
 ;; XXX: This should be a generic function in emacs somewhere, not
 ;; here.
 (defun point-invisible-p ()
diff --git a/emacs/notmuch-logo.png b/emacs/notmuch-logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..53b5e6a40674c574f131f7f66afc52485b65836c
GIT binary patch
literal 1671
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
RS^fY3002ovPDHLkV1lYt4A1}o

literal 0
HcmV?d00001

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 57b7fcf..4c13f32 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -197,10 +197,6 @@ For a mouse binding, return nil."
       (set-buffer-modified-p nil)
       (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
 
-(defgroup notmuch nil
-  "Notmuch mail reader for Emacs."
-  :group 'mail)
-
 (defcustom notmuch-search-hook '(hl-line-mode)
   "List of functions to call when notmuch displays the search results."
   :type 'hook
@@ -210,8 +206,8 @@ For a mouse binding, return nil."
 (defvar notmuch-search-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "?" 'notmuch-help)
-    (define-key map "q" 'kill-this-buffer)
-    (define-key map "x" 'kill-this-buffer)
+    (define-key map "q" 'notmuch-search-quit)
+    (define-key map "x" 'notmuch-search-quit)
     (define-key map (kbd "<DEL>") 'notmuch-search-scroll-down)
     (define-key map "b" 'notmuch-search-scroll-down)
     (define-key map " " 'notmuch-search-scroll-up)
@@ -244,6 +240,14 @@ For a mouse binding, return nil."
 
 (defvar notmuch-search-disjunctive-regexp      "\\<[oO][rR]\\>")
 
+(defun notmuch-search-quit ()
+  "Exit the search buffer, calling any defined continuation function."
+  (interactive)
+  (let ((continuation notmuch-search-continuation))
+    (kill-this-buffer)
+    (when continuation
+      (funcall continuation))))
+
 (defun notmuch-search-scroll-up ()
   "Move forward through search results by one window's worth."
   (interactive)
@@ -336,6 +340,7 @@ Complete list of currently available key bindings:
   (make-local-variable 'notmuch-search-oldest-first)
   (make-local-variable 'notmuch-search-target-thread)
   (make-local-variable 'notmuch-search-target-line)
+  (set (make-local-variable 'notmuch-search-continuation) nil)
   (set (make-local-variable 'scroll-preserve-screen-position) t)
   (add-to-invisibility-spec 'notmuch-search)
   (use-local-map notmuch-search-mode-map)
@@ -692,7 +697,7 @@ characters as well as `_.+-'.
 	  )))
 
 ;;;###autoload
-(defun notmuch-search (query &optional oldest-first target-thread target-line)
+(defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
   "Run \"notmuch search\" with the given query string and display results.
 
 The optional parameters are used as follows:
@@ -710,6 +715,7 @@ The optional parameters are used as follows:
     (set 'notmuch-search-oldest-first oldest-first)
     (set 'notmuch-search-target-thread target-thread)
     (set 'notmuch-search-target-line target-line)
+    (set 'notmuch-search-continuation continuation)
     (let ((proc (get-buffer-process (current-buffer)))
 	  (inhibit-read-only t))
       (if proc
@@ -738,11 +744,11 @@ same relative position within the new buffer."
   (let ((target-line (line-number-at-pos))
 	(oldest-first notmuch-search-oldest-first)
 	(target-thread (notmuch-search-find-thread-id))
-	(query notmuch-search-query-string))
+	(query notmuch-search-query-string)
+	(continuation notmuch-search-continuation))
     (kill-this-buffer)
-    (notmuch-search query oldest-first target-thread target-line)
-    (goto-char (point-min))
-    ))
+    (notmuch-search query oldest-first target-thread target-line continuation)
+    (goto-char (point-min))))
 
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
-- 
1.7.0

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-22  8:27 ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
@ 2010-04-23 20:13   ` Carl Worth
  2010-04-23 22:49     ` Carl Worth
                       ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Carl Worth @ 2010-04-23 20:13 UTC (permalink / raw
  To: David Edmondson, notmuch

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

On Thu, 22 Apr 2010 09:27:33 +0100, David Edmondson <dme@dme.org> wrote:
[no commit message paragraph]

Hi David,

This is really great stuff. I just merged this, and restricted mysefl to
following up with only a very tiny patch to clean up some warnings from
the emacs compilation.

Here is some quick feedback;

  * This should be integrated such that (require 'notmuch) provides the
    notmuch-hello functionality. That's our documented access point for
    getting at notmuch functionality.

  * The logo background is gray on my white-background emacs. That looks odd.

  * It would be great if point were in the search bar right when this
    mode started.

  * I'd like the saved searches to appear before the recent searches I
    think.

  * I'm not sure how useful the numbered shortcuts are for the recent
    searches. We want to encourage people to move to saved searches
    instead, (and the recent searches are quite transient anyway). So do
    we really need these? [I mistook them for message counts at first.]

  * Repeating a recent search by pressing RET on it creates a new
    identical search which doesn't seem all that useful.

  * I would *love* a simple way to import my existing notmuch-folder
    configuration into notmuch-hello. Bonus points if this happens
    automatically.

Finally, I'm quite inclined to make `notmuch' invoke this mode, so think
about that.

That's the feedback I have from a very quick, first look. I'm sure I'll
have more later.

Thanks again! This is really slick.

-Carl

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-23 20:13   ` Carl Worth
@ 2010-04-23 22:49     ` Carl Worth
  2010-04-26  9:36     ` David Edmondson
  2010-04-26 15:07     ` David Edmondson
  2 siblings, 0 replies; 15+ messages in thread
From: Carl Worth @ 2010-04-23 22:49 UTC (permalink / raw
  To: David Edmondson, notmuch

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

On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth <cworth@cworth.org> wrote:
>   * I'd like the saved searches to appear before the recent searches I
>     think.

Actually, this might be OK since the recent searches go away when
restarting emacs.

>   * I would *love* a simple way to import my existing notmuch-folder
>     configuration into notmuch-hello. Bonus points if this happens
>     automatically.

This is as simple as editing my .emacs file to set the
notmuch-hello-saved-searches variable instead of notmuch-folders. So
that's nice.

Though we might want to remove the "-hello" from the name there. It
doesn't really add anything.

-Carl

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-23 20:13   ` Carl Worth
  2010-04-23 22:49     ` Carl Worth
@ 2010-04-26  9:36     ` David Edmondson
  2010-04-26 14:59       ` Carl Worth
  2010-04-26 15:07     ` David Edmondson
  2 siblings, 1 reply; 15+ messages in thread
From: David Edmondson @ 2010-04-26  9:36 UTC (permalink / raw
  To: Carl Worth, notmuch

On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth <cworth@cworth.org> wrote:
>   * This should be integrated such that (require 'notmuch) provides the
>     notmuch-hello functionality. That's our documented access point for
>     getting at notmuch functionality.

I'll do this, but I wonder if it is actually good advice. It causes
notmuch.el (and anything that requires) to be loaded immediately. This
will typically happen before any of a users' customisation settings are
loaded (as `custom-set-variables', etc. generally happens right at the
bottom of .emacs).

A result of this is that notmuch can't use any of the customisation
settings to adapt its' behaviour at load time. A example is (about which
more lower down):

>   * I would *love* a simple way to import my existing notmuch-folder
>     configuration into notmuch-hello. Bonus points if this happens
>     automatically.

notmuch-hello.el has:

(defcustom notmuch-hello-saved-searches notmuch-folders
  "A list of saved searches to display."
  :type '(alist :key-type string :value-type string)
  :group 'notmuch)

So if `notmuch-folders' is set before notmuch-hello.el is loaded, you
get some saved-searches copied from your folders (but this won't
override any specific settings you made for
`notmuch-hello-saved-searches').

Relying on the order in general is bad
(cf. `notmuch-search-authors-width'), but it can allow us to provide
some useful functionality.

If we don't want users to "(require 'notmuch)" we'd probably have to
suggest one or more autoloads - perhaps even provide a file with a bunch
of autoloads in it. Oh, or "(require 'notmuch)" should just load
something that has the autoloads (d'oh!) and some
`define-mail-user-agent' goop so that `compose-mail' does the right
thing.

I'll try to produce a patch for this last thing.

>   * The logo background is gray on my white-background emacs. That
>     looks odd.

Patch sent.

>   * It would be great if point were in the search bar right when this
>     mode started.

This is customisable, and I see that you changed the default ;-)

>   * I'd like the saved searches to appear before the recent searches I
>     think.

Did you come to any conclusion about this?

>   * I'm not sure how useful the numbered shortcuts are for the recent
>     searches. We want to encourage people to move to saved searches
>     instead, (and the recent searches are quite transient anyway). So do
>     we really need these? [I mistook them for message counts at
>     first.]

Patch sent which removes them.

>   * Repeating a recent search by pressing RET on it creates a new
>     identical search which doesn't seem all that useful.

Patch sent.

>   * I would *love* a simple way to import my existing notmuch-folder
>     configuration into notmuch-hello. Bonus points if this happens
>     automatically.

We could have `notmuch-hello' use `notmuch-folders' if
`notmuch-hello-saved-searches' is `nil'. Would that help?

> Finally, I'm quite inclined to make `notmuch' invoke this mode, so
> think about that.

It seems straightforward, I'll produce a patch.

dme.
-- 
David Edmondson, http://dme.org

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26  9:36     ` David Edmondson
@ 2010-04-26 14:59       ` Carl Worth
  2010-04-26 17:16         ` Carl Worth
  0 siblings, 1 reply; 15+ messages in thread
From: Carl Worth @ 2010-04-26 14:59 UTC (permalink / raw
  To: David Edmondson, notmuch

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


-- 
carl.d.worth@intel.com
On Mon, 26 Apr 2010 10:36:28 +0100, David Edmondson <dme@dme.org> wrote:
> I'll do this, but I wonder if it is actually good advice.

My primary point is that all of the implemented functionality,
(including notmuch-hello and notmuch-addresses), needs to be made
available with our documented approach for loading notmuch in
emacs. Currently that's "(require 'notmuch)".

We can certainly come up with another approach if there's a better one.

> So if `notmuch-folders' is set before notmuch-hello.el is loaded, you
> get some saved-searches copied from your folders (but this won't
> override any specific settings you made for
> `notmuch-hello-saved-searches').

OK. That is nice. But also a trick order dependency, yes.

> of autoloads in it. Oh, or "(require 'notmuch)" should just load
> something that has the autoloads (d'oh!) and some
> `define-mail-user-agent' goop so that `compose-mail' does the right
> thing.
> 
> I'll try to produce a patch for this last thing.

Yes, that sounds perfect. I'll look forward to that.

> >   * The logo background is gray on my white-background emacs. That
> >     looks odd.
> 
> Patch sent.

Thanks. Pushed.

> >   * It would be great if point were in the search bar right when this
> >     mode started.
> 
> This is customisable, and I see that you changed the default ;-)

Yes. I'm still on the fence about this change, (as we are talking in the
other thread).

> >   * I'd like the saved searches to appear before the recent searches I
> >     think.
> 
> Did you come to any conclusion about this?

The thing I most want is for my saved searches to be extremely easy to
select. With notmuch-folder, the view wasn't fancy at all, but it was
extremely functional in that the first saved search was under point
right away and just C-n/C-p (or arrow keys) could be used to select
others.

I haven't gotten that same convenience with notmuch-hello yet.

> >   * I'm not sure how useful the numbered shortcuts are for the recent
> >     searches
> 
> Patch sent which removes them.

Pushed.

> >   * Repeating a recent search by pressing RET on it creates a new
> >     identical search which doesn't seem all that useful.
> 
> Patch sent.

And pushed.

> We could have `notmuch-hello' use `notmuch-folders' if
> `notmuch-hello-saved-searches' is `nil'. Would that help?

Yes, that's what I had in mind here.

> > Finally, I'm quite inclined to make `notmuch' invoke this mode, so
> > think about that.
> 
> It seems straightforward, I'll produce a patch.

Excellent. A lot of these would have been easy for me to do of course,
but it seems to be working well for you to "own" the coding of our emacs
code for now. I really appreciate it!

-Carl

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-23 20:13   ` Carl Worth
  2010-04-23 22:49     ` Carl Worth
  2010-04-26  9:36     ` David Edmondson
@ 2010-04-26 15:07     ` David Edmondson
  2 siblings, 0 replies; 15+ messages in thread
From: David Edmondson @ 2010-04-26 15:07 UTC (permalink / raw
  To: Carl Worth, notmuch

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

On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth <cworth@cworth.org> wrote:
> Finally, I'm quite inclined to make `notmuch' invoke this mode, so think
> about that.

See id:1272294424-17363-1-git-send-email-dme@dme.org.

dme.
-- 
David Edmondson, http://dme.org

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26 14:59       ` Carl Worth
@ 2010-04-26 17:16         ` Carl Worth
  2010-04-26 17:38           ` Jameson Rollins
  0 siblings, 1 reply; 15+ messages in thread
From: Carl Worth @ 2010-04-26 17:16 UTC (permalink / raw
  To: David Edmondson, notmuch

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

> On Mon, 26 Apr 2010 10:36:28 +0100, David Edmondson <dme@dme.org> wrote:
> > >   * It would be great if point were in the search bar right when this
> > >     mode started.
> > 
> > This is customisable, and I see that you changed the default ;-)
> 
> Yes. I'm still on the fence about this change, (as we are talking in the
> other thread).
> 
> > >   * I'd like the saved searches to appear before the recent searches I
> > >     think.
> > 
> > Did you come to any conclusion about this?

I thought about these this morning and here are my latest thoughts on
what I would like to see:

  1. Change the "notmuch" and message count in the welcome sentence to
     not be buttons.

  2. Put the saved searches (if any) before the search bar.

  3. When `notmuch-hello' (or even `notmuch' when it gets its new name)
     is invoked directly, move to the first button, (go to point-min and
     then call widget-forward). That is, if the user has any saved
     searches, then point will be on the first one. If the user has no
     saved searches, then point will be on the search bar.

  4. Fix refresh of notmuch-hello to leave point in the same logical
     place, (the same saved-search widget at least).

What do you think? This will give new users the ability to just type a
search string as their first interaction. Users with a little more
experience, (enough to have saved a search), will have easier access to
those, and will not have the search bar interfering with keybindings.

-Carl

-- 
carl.d.worth@intel.com
On Mon, 26 Apr 2010 07:59:07 -0700, Carl Worth <cworth@cworth.org> wrote:

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26 17:16         ` Carl Worth
@ 2010-04-26 17:38           ` Jameson Rollins
  2010-04-26 18:03             ` David Edmondson
  0 siblings, 1 reply; 15+ messages in thread
From: Jameson Rollins @ 2010-04-26 17:38 UTC (permalink / raw
  To: Carl Worth, David Edmondson, notmuch

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

On Mon, 26 Apr 2010 10:16:42 -0700, Carl Worth <cworth@cworth.org> wrote:
> What do you think? This will give new users the ability to just type a
> search string as their first interaction. Users with a little more
> experience, (enough to have saved a search), will have easier access to
> those, and will not have the search bar interfering with keybindings.

What about advanced users?  I really want my notmuch front page to just
be a particular saved search.  The notmuch-hello looks neat, but I don't
really see myself ever using it, since I can access all the
functionality I need already.  All I really want from a front page is
the main search that I look at all the time ("tag:inbox and not
tag:deleted"), have it *not* close if I accidentally hit 'q', and a way
to pop back to it from wherever I am.  Could we make it configurable so
that the front page is either the hello page, or the special search page
I describe?

jamie.

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26 17:38           ` Jameson Rollins
@ 2010-04-26 18:03             ` David Edmondson
  2010-04-26 18:38               ` Carl Worth
  0 siblings, 1 reply; 15+ messages in thread
From: David Edmondson @ 2010-04-26 18:03 UTC (permalink / raw
  To: Jameson Rollins, Carl Worth, notmuch

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

On Mon, 26 Apr 2010 13:38:37 -0400, Jameson Rollins <jrollins@finestructure.net> wrote:
> What about advanced users?  I really want my notmuch front page to just
> be a particular saved search.  The notmuch-hello looks neat, but I don't
> really see myself ever using it, since I can access all the
> functionality I need already.  All I really want from a front page is
> the main search that I look at all the time ("tag:inbox and not
> tag:deleted"), have it *not* close if I accidentally hit 'q', and a way
> to pop back to it from wherever I am.  Could we make it configurable so
> that the front page is either the hello page, or the special search page
> I describe?

Isn't something like:

(global-set-key "\C-ci" '(lambda () (interactive) (notmuch-search "tag:inbox and not tag:deleted" notmuch-search-oldest-first)))

all you need?

dme.
-- 
David Edmondson, http://dme.org

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

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26 18:03             ` David Edmondson
@ 2010-04-26 18:38               ` Carl Worth
  0 siblings, 0 replies; 15+ messages in thread
From: Carl Worth @ 2010-04-26 18:38 UTC (permalink / raw
  To: David Edmondson, Jameson Rollins, notmuch

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


-- 
carl.d.worth@intel.com
On Mon, 26 Apr 2010 19:03:35 +0100, David Edmondson <dme@dme.org> wrote:
> > What about advanced users?  I really want my notmuch front page to just
> > be a particular saved search.  The notmuch-hello looks neat, but I don't
> > really see myself ever using it, since I can access all the
> > functionality I need already.  All I really want from a front page is
> > the main search that I look at all the time ("tag:inbox and not
> > tag:deleted"), have it *not* close if I accidentally hit 'q', and a way
> > to pop back to it from wherever I am.  Could we make it configurable so
> > that the front page is either the hello page, or the special search page
> > I describe?
> 
> (global-set-key "\C-ci" '(lambda () (interactive) (notmuch-search "tag:inbox and not tag:deleted" notmuch-search-oldest-first)))

It's really close, I think.

It doesn't add the "not close if I hit 'q'" feature, though.

And I agree that that feature is really important for using a default
search as the "primary landing page" of notmuch. I really wanted that
feature when I was using the original `notmuch' command as my primary
landing page.

The idea is to allow the user to basically just keep hitting 'q' to
quickly pop back up to the primary search.

As far as "could we make it configurable?": Of course! This is emacs
after all. ;-)

-Carl


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

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

end of thread, other threads:[~2010-04-26 18:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-12 10:13 [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
2010-04-13  4:58 ` Xavier Maillard
2010-04-13  6:54   ` David Edmondson
2010-04-13 10:25 ` Michal Sojka
2010-04-13 10:33   ` David Edmondson
  -- strict thread matches above, loose matches on Subject: below --
2010-04-22  1:11 Update on 0.3 progress Carl Worth
2010-04-22  8:27 ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
2010-04-23 20:13   ` Carl Worth
2010-04-23 22:49     ` Carl Worth
2010-04-26  9:36     ` David Edmondson
2010-04-26 14:59       ` Carl Worth
2010-04-26 17:16         ` Carl Worth
2010-04-26 17:38           ` Jameson Rollins
2010-04-26 18:03             ` David Edmondson
2010-04-26 18:38               ` Carl Worth
2010-04-26 15:07     ` David Edmondson

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