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
* Update on 0.3 progress
@ 2010-04-22  1:11 Carl Worth
  2010-04-22  8:27 ` [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch David Edmondson
  0 siblings, 1 reply; 15+ 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] 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).