unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Opening the merge window for 0.3
@ 2010-04-16 20:32 Carl Worth
  2010-04-22  1:11 ` Update on 0.3 progress Carl Worth
  0 siblings, 1 reply; 18+ messages in thread
From: Carl Worth @ 2010-04-16 20:32 UTC (permalink / raw)
  To: Notmuch list

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

I'm officially opening the merge window for the upcoming 0.3 release
(about a week from now).

I know that I want to merge David Edmunson's rewrite of the emacs
interface to be built on top of --format=json and add a ton of features,
(better attachment handling, notmuch-hello, etc.). I think that's more
than enough to justify a new release right there.

But if you have other things you'd like to see in this release, please
send a message to the list, (either as a new message or a reply to a
previous post where the feature/bug-fix was originally proposed). Please
don't send feature requests as replies to this message.

The best merge requests will be things that have existing, tested
patches already.

I know that some of the most desired features right now are folder:
searching and maildir-flag synchronization. Unfortunately, I think both
of these will be postponed until the 0.4 release, but I could be wrong.

-Carl

PS. I still never sent a list of the features which were proposed for
the 0.2 release but postponed. I'll assemble that list soon with my
comments on where each of the features stand.

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

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

* Update on 0.3 progress
  2010-04-16 20:32 Opening the merge window for 0.3 Carl Worth
@ 2010-04-22  1:11 ` Carl Worth
  2010-04-22  2:49   ` Dirk Hohndel
                     ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Carl Worth @ 2010-04-22  1:11 UTC (permalink / raw)
  To: Notmuch list

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

On Fri, 16 Apr 2010 13:32:25 -0700, Carl Worth <cworth@cworth.org> wrote:
> I know that I want to merge David Edmunson's rewrite of the emacs
> interface to be built on top of --format=json and add a ton of features,
> (better attachment handling, notmuch-hello, etc.). I think that's more
> than enough to justify a new release right there.

The bulk of this rewrite is merged now. I left a few features out with
review to David. He (or others) may want to refresh some of those to get
them in. (I'd especially like a binding for opening all messages in a
thread).

I also want to look at notmuch-hello stuff now.

> But if you have other things you'd like to see in this release, please
> send a message to the list

Most of what came in in response to this request has now been merged.
Notable things that made the merge window but have not been merged yet
include:

  * Improve heuristic for guessing best from address in replies
    id:1271451102-11336-1-git-send-email-hohndel@infradead.org

    I just need to review and test this still.

  * The archive operation should only archive open messages
    id:87633sfnyq.fsf@yoom.home.cworth.org    

    This still needs an implementation or else it won't make it.
> 
> PS. I still never sent a list of the features which were proposed for
> the 0.2 release but postponed. I'll assemble that list soon with my
> comments on where each of the features stand.

Here's that list now. I really should have had this list ready at the
time I announced the opening of the 0.3 window so that people would have
had more notice to refresh these. I'll try to be better about that in
the future:

  * Add maildir directory name as tag name for messages
    id:20100210030142.GD16686@mail.rocksoft.com

    I've postponed this until a database-schema-update planned for 0.4

  * Initial support for maildir flags
    id:1270755931-24290-1-git-send-email-pioto@pioto.org

    Same here

  * Reordering and cleanup of thread authors
    id:m31veru7vn.fsf@x200.gr8dns.org

    This is an interesting feature, but says "I don't think this is
    ready to be pulled" in the commit message and then says "I'll update
    the patch" at the end of the thread with no update. So I'd still
    like to see this refreshed (and could still take this for 0.3).

    Note that the recent fix for the sorting of calls to
    _add_matched_messages probably means that this feature will work
    better now than before.

  * 'F' in search mode takes us to a list of folders
    id:87vdc2q2l7.fsf@yoom.home.cworth.org

    I rejected this on the basis of the choice of key-binding. I expect
    we'll get a good keybinding once we add notmuch-hello.

  * Fcc, Maildir, and Emacs message-mode -- a bit of code
    id:873a1zs3t5.fsf@jhu.edu

    I've postponed this due to the "I've not tested this robustly since
    I don't actually use it". With a little confirmed testing, I'd love
    to have this in place (and on by default)

  * RFC: User-Agent header
    id:87iq821hba.fsf@SSpaeth.de

    This seemed like a good feature proposal, but I didn't see a
    complete implementation in time for 0.2. There is one now

  * Mailstore abstraction v4
    id:1270737766-29237-1-git-send-email-sojkam1@fel.cvut.cz

    I rejected this due to being extra abstraction in advance of any use
    case. Michal has recently been following up with pieces of this that
    are directly justified, (like "notmuch cat"). Thanks!

-Carl

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

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

* Re: Update on 0.3 progress
  2010-04-22  1:11 ` Update on 0.3 progress Carl Worth
@ 2010-04-22  2:49   ` Dirk Hohndel
  2010-04-22  6:10   ` Jesse Rosenthal
  2010-04-22  8:27   ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
  2 siblings, 0 replies; 18+ messages in thread
From: Dirk Hohndel @ 2010-04-22  2:49 UTC (permalink / raw)
  To: Carl Worth, Notmuch list

On Wed, 21 Apr 2010 18:11:14 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Fri, 16 Apr 2010 13:32:25 -0700, Carl Worth <cworth@cworth.org> wrote:
> > I know that I want to merge David Edmunson's rewrite of the emacs
> > interface to be built on top of --format=json and add a ton of features,
> > (better attachment handling, notmuch-hello, etc.). I think that's more
> > than enough to justify a new release right there.
> 
> The bulk of this rewrite is merged now. I left a few features out with
> review to David. He (or others) may want to refresh some of those to get
> them in. (I'd especially like a binding for opening all messages in a
> thread).
> 
> I also want to look at notmuch-hello stuff now.
> 
> > But if you have other things you'd like to see in this release, please
> > send a message to the list
> 
> Most of what came in in response to this request has now been merged.
> Notable things that made the merge window but have not been merged yet
> include:
> 
>   * Improve heuristic for guessing best from address in replies
>     id:1271451102-11336-1-git-send-email-hohndel@infradead.org
> 
>     I just need to review and test this still.

I submitted tests for this today.
id:1271886958-3276-1-git-send-email-hohndel@infradead.org
 
>   * The archive operation should only archive open messages
>     id:87633sfnyq.fsf@yoom.home.cworth.org    
> 
>     This still needs an implementation or else it won't make it.
> > 
> > PS. I still never sent a list of the features which were proposed for
> > the 0.2 release but postponed. I'll assemble that list soon with my
> > comments on where each of the features stand.
> 
> Here's that list now. I really should have had this list ready at the
> time I announced the opening of the 0.3 window so that people would have
> had more notice to refresh these. I'll try to be better about that in
> the future:
> 
>   * Add maildir directory name as tag name for messages
>     id:20100210030142.GD16686@mail.rocksoft.com
> 
>     I've postponed this until a database-schema-update planned for 0.4
> 
>   * Initial support for maildir flags
>     id:1270755931-24290-1-git-send-email-pioto@pioto.org
> 
>     Same here
> 
>   * Reordering and cleanup of thread authors
>     id:m31veru7vn.fsf@x200.gr8dns.org
> 
>     This is an interesting feature, but says "I don't think this is
>     ready to be pulled" in the commit message and then says "I'll update
>     the patch" at the end of the thread with no update. So I'd still
>     like to see this refreshed (and could still take this for 0.3).
> 
>     Note that the recent fix for the sorting of calls to
>     _add_matched_messages probably means that this feature will work
>     better now than before.

Cool - I'll take a look if I can get you an updated patch tonight.

>   * 'F' in search mode takes us to a list of folders
>     id:87vdc2q2l7.fsf@yoom.home.cworth.org
> 
>     I rejected this on the basis of the choice of key-binding. I expect
>     we'll get a good keybinding once we add notmuch-hello.
> 
>   * Fcc, Maildir, and Emacs message-mode -- a bit of code
>     id:873a1zs3t5.fsf@jhu.edu
> 
>     I've postponed this due to the "I've not tested this robustly since
>     I don't actually use it". With a little confirmed testing, I'd love
>     to have this in place (and on by default)
> 
>   * RFC: User-Agent header
>     id:87iq821hba.fsf@SSpaeth.de
> 
>     This seemed like a good feature proposal, but I didn't see a
>     complete implementation in time for 0.2. There is one now
> 
>   * Mailstore abstraction v4
>     id:1270737766-29237-1-git-send-email-sojkam1@fel.cvut.cz
> 
>     I rejected this due to being extra abstraction in advance of any use
>     case. Michal has recently been following up with pieces of this that
>     are directly justified, (like "notmuch cat"). Thanks!

Thanks for these updates.

I have two more that I submitted 

- the 'G' keybinding that calls an external poll program: this allows
  you to run notmuch new from within emacs at times that are convenient
  for the user; otherwise a user either needs to manually run this from
  outside emacs, or notmuch new is run through cron or offlineimap and
  in that case we get the weird Xapian database access errors
  in the discussion of the patch there was concern that this stalls
  emacs for potentially a long time - I find that acceptable as email is
  imported - other people may find differently (and decide not to use
  this feature) id:m339z4csi1.fsf@x200.gr8dns.org

- the 'd' keybinding that deletes mail/threads (similar to 'a'rchive)
  id:1271891763-10757-1-git-send-email-hohndel@infradead.org

Additionally, I'd really love to see the address completion to be
included in notmuch (at least the emacs part of it - I think there's
still some debate whether the vala sources would cause too much of a
build dependency to be integrated.
I don't think this was ever submitted to the mailing list as a
patch. The .el file that was posted on IRC is here:
http://github.com/dme/notmuch/raw/dme-play/emacs/notmuch-address.el


Thanks

/D 

-- 
Dirk Hohndel
Intel Open Source Technology Center

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

* Re: Update on 0.3 progress
  2010-04-22  1:11 ` Update on 0.3 progress Carl Worth
  2010-04-22  2:49   ` Dirk Hohndel
@ 2010-04-22  6:10   ` Jesse Rosenthal
  2010-04-22  8:27   ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
  2 siblings, 0 replies; 18+ messages in thread
From: Jesse Rosenthal @ 2010-04-22  6:10 UTC (permalink / raw)
  To: Carl Worth, Notmuch list

On Wed, 21 Apr 2010 18:11:14 -0700, Carl Worth <cworth@cworth.org> wrote:
> Most of what came in in response to this request has now been merged.
> Notable things that made the merge window but have not been merged yet
> include...

Hi Carl,

Just wanted to call one more thing to your attention: the patch covering
the regression in argument-quoting to enable remote usage
( id:m14oj4qz5r.fsf@watt.gilman.jhu.edu ).

The code in notmuch-show changed somewhat, so I elected to rewrite this
rather trivial patch froms scratch.

Thanks for the updates.

All best,
Jesse

^ permalink raw reply	[flat|nested] 18+ 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  2:49   ` Dirk Hohndel
  2010-04-22  6:10   ` Jesse Rosenthal
@ 2010-04-22  8:27   ` David Edmondson
  2010-04-23 20:13     ` Carl Worth
  2 siblings, 1 reply; 18+ 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
zcmV;226*|2P)<h;3K|Lk000e1NJLTq0024w001%w1^@s64d}>400006VoOIv0RI60
z0RN!9r;`8x20TebK~!jg?V4Lm990;{f4jA<BJ5Ia6d_>Ida0$gyH@L3w?qwA+IXRj
zh8k-lC8VO%;3d&0Rxu_9wGWNaQX<qopy3kHn(%<yssv2cjiofu)>gn0s;CuFOj~x3
z4`&8umt|*WXIWC~FFDz{d}q%2@40>Roq@<WfoFl)I(9~}12w>3Ks_)kM$fg(VxS+$
z0Uicc0hd{L-W`C@qz9~4&?x8W-0uL=00&SDJOZo+T);)Z55RZ8x4;Pl<^3LV{;QeF
z#)F4|y}(?}wOPRJz?;A!;5hIRP=;*zODB0&0rC$lnWDN{VmojXP!z#tK2Qp@0H=^$
zvk&+XcmcSJ@jvS2DXXakoIr(gTxl>*60jDi1_lTompwo?P>8kh9&^?MUgh{z;1ZMh
z?ZA!5R{RDCFfKZP9N*=NjXehSjhgM63b=ty7N3`aoXKAYJ_r6_T=)rOFIbE06>&q`
zZB=$yeCEZ#G0nLRxEfdoyn&qbhLGd@Q{=dxZ?R0><>fx$<B)4V11T6=PQu|(l8OKh
zE9rgZnjN?bxB*xSyo+q%y}&0xD{$IOp*EfS+ks-_SW;O6+ycC9rXUU11N$)VZP|fq
zkizF9yZmwB3*bWFZ{U|nb2}W4eFV>nQKzJ&qyq*j>{aZ~HzhMX>wsM3gjN;N(q^*-
z3JVK`+wB%@ZEZqj=gys?wY61*qpYk<3=9kiA%xhoXOCF4Xptx`E>;EWv0AY+J9~%Y
zJ>Y5NGBrofSO_6RdwaWZyWOI&uuu#R4vM0pBH{P@!wTKMf4?X%FBfaptP$DS*}~`Z
z2_b}0p${r{RwtMwU@LkpsbNgO=;)}}wr!ip%*+%kSFQ{zbYx^iY}v9!IGs*WTU#pv
zfxy^3j0xSO*tw(AH^w^PHsCoRQ_nbPfu1pA1|=mWY~H*XfaS}V<Ma8(?l(3z;&Qnd
z9UY~(xR~thY-~2Y`D_A?kl$!o0elHG0Qc(|hh1K}y1Hm?Zf4i6U2NE}0hh}~Utb?H
zXU?RirUsA4LuY3v4Gj%re~JlIfmR%XBwz&a14n=>^)gIwxlW!uNpf;B?d|QPrl#Wa
z`It9v9;KzFw6wI)+uKW5R~K1XS#)%CL{rIFwCFv^^;D$?9kCNyw5h3yw6rvAHXAuP
zIRKQGmyg}g&(Ej1xtXD%Au=*D=<n|*EiKJVCDoR+BJ@_^G0k}$virU^S%wKMT31(x
z*XzaO@l0AuZf-6@2vSl~sIRX#TS--*(`-gf{(lH|VvYh=M9LH-w5qC#^z?LGE|+d;
z9*+mF*URqRyQ8V7_SY<TBVX`CIf`@}!(s;zLQq{@&G7Ir1qB6$OI)yE0dBXOii!&S
ze!tOdR)wwrz6x`_o(QwA9iXzZlDxb;y1TnswrrWHQa5hgNFWek#}30UHCBW=fMJ5W
zt;#VXb>D=9gd@br*G)`JJZPY@{fd2)0ozd4BU^Mbo<Y9yg(V*t#k$Z_I+aivR_s4B
zU>k}y2oR2W!1Lj5*ntm#Y~cGS3RXD++==v5B4Gy-m1DDA*U9AFR;336?w}1BzI+Gh
z0?rV*1%E=WUu)5Sfmcb^<UeFEkBT;S6^W;SYt1}(Hn0%585yZxtrWBb8N7~$490~H
zn9N&=vEbR|$k=iaky_#uU}SPJgJY6oJ)FomQlxIH(u))uM7+a`T5$;&@ABbdSCKdf
zT&KM-okGF*8;l2NGf_?>A<n~e3pLVxlhL1TL+L}#2V<NKLhmIy=i&g6rJfiaBe5b>
zSfn?YT;LTT9qCP(X;F~t^%KBv$gPmL@)E&o@hTnrCmG+Fi#8o3q#MVBts#}jH;^Y2
z>BJ0TPT*nWA9Vptf7dlKMt=kz1s+H4xGhF59dnVhb^`L7h(D2$`cC97e5dvy(=F6Y
zfXokktt8XLd)5sVW;Nt#n6qJdi3$G;og&T|p`i}Ke^%%@(V}yhxWk?t$MWOGi%j%h
z0?1g?lw*3&&mgmqZ~2+X@Z&0^lOB#U$N=45<hO-ANGINKMBE6m61o(~LvHRaM1Ck~
zWmud>hD17%A9mCuw;ZO8ROCldF$sW2NCD*cP1EvyuO0a{$W)8ernjQ4?7w==f>M#W
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] 18+ 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
                         ` (6 more replies)
  0 siblings, 7 replies; 18+ 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] 18+ 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-24 12:31       ` Ideas for making notmuch-hello easier to navigate Carl Worth
                         ` (5 subsequent siblings)
  6 siblings, 0 replies; 18+ 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] 18+ messages in thread

* Ideas for making notmuch-hello easier to navigate
  2010-04-23 20:13     ` Carl Worth
  2010-04-23 22:49       ` Carl Worth
@ 2010-04-24 12:31       ` Carl Worth
  2010-04-26  9:25       ` [PATCH 1/3] emacs: Adapt the logo background colour to that of the frame David Edmondson
                         ` (4 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: Carl Worth @ 2010-04-24 12:31 UTC (permalink / raw)
  To: David Edmondson, notmuch

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

On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth <cworth@cworth.org> wrote:
> That's the feedback I have from a very quick, first look. I'm sure I'll
> have more later.

In order to give notmuch-hello some good testing, I switched over to
using it exclusively instead of notmuch-folder. The biggest frustration
I'm having is easily picking the desired saved search with only the
keyboard, (I tend to be the kind of person that prefers the keyboard
over any mouse/trackpad/pointer-stick-thingy).

From the initial screen, (with point at the upper-left corner), it takes
several keypresses of TAB before I get to the first saved search. It
might be even more natural to just use C-n to get to the line of
interest, but then I end up in the first column where the saved search
isn't active for RET.

Here are a few different ideas to simplify things:

  * Provide a target column from the beginning so that C-n moves point
    to an active location.

  * Consider a single-column layout for saved searches so that C-n is
    sufficient for selecting one.

  * Consider moving the name of the saved search to before the count so
    that the initial column is active. Otherwise considering making a
    larger active target, (name and count, maybe more). With a
    single-column layout the whole row could be active.

  * Consider moving saved searches to above the big search bar. This way
    the become the primary thing to access, which is what I want at
    least. Then recent searches could stay just below the search bar,
    which also makes sense. And for a new user, the big search bar would
    be at the top which gives a good introduction to the system.

  * Provide keypbindings for "next (and previous) saved search" which
    would move point to the next or previous saved-search name in the
    buffer.

  * Provide a keypress for easily typing a name of a saved search. I
    think I'd like this to work like i-search, but would only match
    saved-search names, and a single press of RET would both terminate
    the isearch and activate the saved search.

Any/all of those would help for selecting a single group. Then the other
feature that I would find essential, (and that notmuch-folder had):

  * Make it so that when quitting from a search and returning to
    notmuch-hello, that point is at the same position it was before, (so
    that "q" followed by "RET" returns the the same search view). This
    would make it so that selecting the next search of interest would be
    much easier than now.

Just throwing those ideas out in case anyone wants to try implementing
some and experimenting. I'm busy enough merging code now that I don't
have time to write any of the above yet, but I hope to have time to
start coding again soon.

-Carl

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

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

* [PATCH 1/3] emacs: Adapt the logo background colour to that of the frame
  2010-04-23 20:13     ` Carl Worth
  2010-04-23 22:49       ` Carl Worth
  2010-04-24 12:31       ` Ideas for making notmuch-hello easier to navigate Carl Worth
@ 2010-04-26  9:25       ` David Edmondson
  2010-04-26  9:25       ` [PATCH 2/3] emacs: Remove the accelerator keys from the hello buffer David Edmondson
                         ` (3 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2010-04-26  9:25 UTC (permalink / raw)
  To: notmuch

The notmuch logo uses transparency. That can display poorly when
inserting the image into an emacs buffer (black logo on a black
background), so force the background colour of the image. We use a
face (`notmuch-hello-logo-background') to represent the colour so that
`defface' can be used to declare the different possible colours, which
depend on whether the frame has a light or dark background.
---
 emacs/notmuch-hello.el |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 482ef68..3a74ebd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -55,9 +55,14 @@
   :type 'boolean
   :group 'notmuch)
 
-(defcustom notmuch-hello-logo-background "#5f5f5f"
+(defface notmuch-hello-logo-background
+  '((((class color)
+      (background dark))
+     (:background "#5f5f5f"))
+    (((class color)
+      (background light))
+     (:background "white")))
   "Background colour for the notmuch logo."
-  :type 'color
   :group 'notmuch)
 
 (defcustom notmuch-hello-jump-to-search t
@@ -209,12 +214,16 @@ diagonal."
 
   (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))))
+      ;; The notmuch logo uses transparency. That can display poorly
+      ;; when inserting the image into an emacs buffer (black logo on
+      ;; a black background), so force the background colour of the
+      ;; image. We use a face to represent the colour so that
+      ;; `defface' can be used to declare the different possible
+      ;; colours, which depend on whether the frame has a light or
+      ;; dark background.
+      (setq image (cons 'image
+			(append (cdr image)
+				(list :background (face-background 'notmuch-hello-logo-background)))))
       (insert-image image))
     (widget-insert "  "))
 
-- 
1.7.0

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

* [PATCH 2/3] emacs: Remove the accelerator keys from the hello buffer
  2010-04-23 20:13     ` Carl Worth
                         ` (2 preceding siblings ...)
  2010-04-26  9:25       ` [PATCH 1/3] emacs: Adapt the logo background colour to that of the frame David Edmondson
@ 2010-04-26  9:25       ` David Edmondson
  2010-04-26  9:25       ` [PATCH 3/3] emacs: Add a search to the 'recent searches' list once only David Edmondson
                         ` (2 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2010-04-26  9:25 UTC (permalink / raw)
  To: notmuch

Carl though that the recent search accelerator keys are not useful, so
remove them.
---
 emacs/notmuch-hello.el |   44 ++++++++++++++++++--------------------------
 1 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3a74ebd..52f162a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -266,20 +266,26 @@ diagonal."
 		   "clear")
     (widget-insert "\n\n")
     (let ((start (point))
-	  (key 0))
+	  (nth 0))
       (mapc '(lambda (search)
-	       (widget-insert (format "%2d: " key))
-	       (let ((widget-symbol (intern (format "notmuch-hello-search-%d" key))))
+	       (let ((widget-symbol (intern (format "notmuch-hello-search-%d" nth))))
 		 (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))
+				     ;; Don't let the search boxes be
+				     ;; less than 8 characters wide.
+				     :size (max 8
+						(- (window-width)
+						   ;; Leave some space
+						   ;; at the start and
+						   ;; end of the
+						   ;; boxes.
+						   (* 2 notmuch-hello-indent)
+						   ;; 1 for the space
+						   ;; before the
+						   ;; `[save]' button. 6
+						   ;; for the `[save]'
+						   ;; button.
+						   1 6))
 				     :action (lambda (widget &rest ignore)
 					       (notmuch-hello-search (widget-value widget)))
 				     search))
@@ -290,7 +296,7 @@ diagonal."
 				:notmuch-saved-search-widget widget-symbol
 				"save"))
 	       (widget-insert "\n")
-	       (setq key (1+ key)))
+	       (setq nth (1+ nth)))
 	    notmuch-hello-recent-searches)
       (indent-rigidly start (point) notmuch-hello-indent)))
 
@@ -329,12 +335,6 @@ diagonal."
     (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"))
@@ -351,14 +351,6 @@ diagonal."
   (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
-- 
1.7.0

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

* [PATCH 3/3] emacs: Add a search to the 'recent searches' list once only
  2010-04-23 20:13     ` Carl Worth
                         ` (3 preceding siblings ...)
  2010-04-26  9:25       ` [PATCH 2/3] emacs: Remove the accelerator keys from the hello buffer David Edmondson
@ 2010-04-26  9:25       ` David Edmondson
  2010-04-26  9:36       ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
  2010-04-26 15:07       ` David Edmondson
  6 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2010-04-26  9:25 UTC (permalink / raw)
  To: notmuch

Avoiding adding the same search string to the 'recent searches' list
more than once by testing whether the string was already used with
`member' rather than `memq'.
---
 emacs/notmuch-hello.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 52f162a..30b3a5e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -77,7 +77,7 @@ field."
 (defvar notmuch-hello-recent-searches nil)
 
 (defun notmuch-hello-remember-search (search)
-  (if (not (memq search notmuch-hello-recent-searches))
+  (if (not (member search notmuch-hello-recent-searches))
       (push search notmuch-hello-recent-searches))
   (if (> (length notmuch-hello-recent-searches)
 	 notmuch-hello-recent-searches-max)
-- 
1.7.0

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

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-23 20:13     ` Carl Worth
                         ` (4 preceding siblings ...)
  2010-04-26  9:25       ` [PATCH 3/3] emacs: Add a search to the 'recent searches' list once only David Edmondson
@ 2010-04-26  9:36       ` David Edmondson
  2010-04-26 14:59         ` Carl Worth
  2010-04-26 15:07       ` David Edmondson
  6 siblings, 1 reply; 18+ 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] 18+ messages in thread

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-26  9:36       ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
@ 2010-04-26 14:59         ` Carl Worth
  2010-04-26 17:16           ` Carl Worth
  0 siblings, 1 reply; 18+ 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] 18+ messages in thread

* Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch
  2010-04-23 20:13     ` Carl Worth
                         ` (5 preceding siblings ...)
  2010-04-26  9:36       ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
@ 2010-04-26 15:07       ` David Edmondson
  6 siblings, 0 replies; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ messages in thread

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

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16 20:32 Opening the merge window for 0.3 Carl Worth
2010-04-22  1:11 ` Update on 0.3 progress Carl Worth
2010-04-22  2:49   ` Dirk Hohndel
2010-04-22  6:10   ` Jesse Rosenthal
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-24 12:31       ` Ideas for making notmuch-hello easier to navigate Carl Worth
2010-04-26  9:25       ` [PATCH 1/3] emacs: Adapt the logo background colour to that of the frame David Edmondson
2010-04-26  9:25       ` [PATCH 2/3] emacs: Remove the accelerator keys from the hello buffer David Edmondson
2010-04-26  9:25       ` [PATCH 3/3] emacs: Add a search to the 'recent searches' list once only David Edmondson
2010-04-26  9:36       ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch 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).