[PATCH] fixed typo in a comment

2011-05-29 Thread notm...@dima.secretsauce.net
From: Dima Kogan 

---

 This patch corrects a typo

 test/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index b6859ea..de492a7 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,4 +1,4 @@
-# See Makfefile.local for the list of files to be compiled in this
+# See Makefile.local for the list of files to be compiled in this
 # directory.
 all:
$(MAKE) -C .. all
-- 
1.7.4.4



[PATCH] added keys to hide/show a portion of the thread

2011-05-29 Thread notm...@dima.secretsauce.net
From: Dima Kogan 

---

 Here's another improvement. In the notmuch-show display this binds '[' to
 expand all the children messages (replies). Analogously ']' collapses all the
 children messages.

 dima

 emacs/notmuch-show.el |   34 ++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2ba151e..600f3ec 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -813,6 +813,8 @@ function is used. "
(define-key map " " 'notmuch-show-advance-and-archive)
(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+   (define-key map "]" 'notmuch-show-hide-hierarchy)
+   (define-key map "[" 'notmuch-show-show-hierarchy)
map)
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1266,6 +1268,38 @@ argument, hide all of the messages."
  until (not (notmuch-show-goto-message-next
   (force-window-update))

+; get the depth, assuming the point is at the start of the header line
+(defun notmuch-show-get-depth ()
+  (save-excursion
+(let ((start (point)))
+  (- (re-search-forward "^ *") start
+
+(defun notmuch-show-hideshow-hierarchy (doshow)
+  "Hides or shows this message and all its replies"
+  (interactive)
+  (save-excursion
+(notmuch-show-move-to-message-top)
+
+(let ((depth0 (notmuch-show-get-depth)))
+  (loop do (notmuch-show-message-visible 
(notmuch-show-get-message-properties)
+ doshow)
+until (or (not (notmuch-show-goto-message-next))
+  (<= (notmuch-show-get-depth) depth0
+  (force-window-update))
+)
+
+(defun notmuch-show-show-hierarchy ()
+  "Show this message and all its replies"
+  (interactive)
+  (notmuch-show-hideshow-hierarchy 1)
+)
+
+(defun notmuch-show-hide-hierarchy ()
+  "Hide this message and all its replies"
+  (interactive)
+  (notmuch-show-hideshow-hierarchy nil)
+)
+
 (defun notmuch-show-next-button ()
   "Advance point to the next button in the buffer."
   (interactive)
-- 
1.7.4.4



[PATCH] Added C-up and C-down to cycle through previous searches

2011-05-29 Thread notm...@dima.secretsauce.net
From: Dima Kogan 

---

 Hi.

 I made a few improvements to the emacs UI. This patch allows the user to scroll
 through the most recent searches with C-up and C-down while in the search box.

 dima

 emacs/notmuch-hello.el |   49 +--
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 916cda1..56f853f 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -123,6 +123,12 @@ Typically \",\" in the US and UK and \".\" in Europe."

 (defvar notmuch-hello-recent-searches nil)

+(defvar notmuch-hello-cyclerecent-index 0
+  "The current index of the most-recent searches" )
+
+(defvar notmuch-hello-search-widget nil
+  "The search widget")
+
 (defun notmuch-hello-remember-search (search)
   (if (not (member search notmuch-hello-recent-searches))
   (push search notmuch-hello-recent-searches))
@@ -148,6 +154,28 @@ Typically \",\" in the US and UK and \".\" in Europe."
   (match-string 1 search)
 search))

+(defun notmuch-hello-cyclerecent-next ()
+  "Cycle through the most recently-searched queries, going forwards"
+  (interactive)
+  (notmuch-hello-cyclerecent 1))
+
+(defun notmuch-hello-cyclerecent-prev ()
+  "Cycle through the most recently-searched queries, going backwards"
+  (interactive)
+  (notmuch-hello-cyclerecent -1))
+
+(defun notmuch-hello-cyclerecent (d) ()
+
+  (when notmuch-hello-recent-searches ; if no recent searches, do nothing
+(let ((N (length notmuch-hello-recent-searches)))
+  (setq notmuch-hello-cyclerecent-index
+(% (+ notmuch-hello-cyclerecent-index d N) N))) ; update the index
+
+(widget-value-set notmuch-hello-search-widget
+  (nth notmuch-hello-cyclerecent-index 
notmuch-hello-recent-searches))
+(widget-setup))
+)
+
 (defun notmuch-hello-search (search)
   (let ((search (notmuch-hello-trim search)))
 (notmuch-hello-remember-search search)
@@ -455,13 +483,19 @@ Complete list of currently available key bindings:

(widget-insert "\nSearch: ")
(setq notmuch-hello-search-bar-marker (point-marker))
-   (widget-create 'editable-field
-  ;; Leave some space at the start and end of the
-  ;; search boxes.
-  :size (max 8 (- (window-width) notmuch-hello-indent
-  (length "Search: ")))
-  :action (lambda (widget  ignore)
-(notmuch-hello-search (widget-value widget
+   (setq notmuch-hello-search-widget
+  (widget-create 'editable-field
+ ;; Leave some space at the start and end of the
+ ;; search boxes.
+ :size (max 8 (- (window-width) 
notmuch-hello-indent
+ (length "Search: ")))
+ :action (lambda (widget  ignore)
+   (notmuch-hello-search (widget-value 
widget)))
+ :keymap (let ((map (make-sparse-keymap)))
+   (set-keymap-parent map 
widget-field-keymap)
+   (define-key map (kbd "")   
'notmuch-hello-cyclerecent-prev)
+   (define-key map (kbd "") 
'notmuch-hello-cyclerecent-next)
+   map)))
(widget-insert "\n")

(when notmuch-hello-recent-searches
@@ -535,6 +569,7 @@ Complete list of currently available key bindings:
(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")
+ (widget-insert "In the search box, C-up/C-down cycles through the 
recent searches.\n")
  (widget-insert "Save recent searches with the `save' button.\n"))
(when notmuch-saved-searches
  (widget-insert "Edit saved searches with the `edit' button.\n"))
-- 
1.7.4.4