[PATCH] Add dir-locals style variables for C++ and Elisp code.

2011-06-07 Thread Dima Kogan
> On Tue,  7 Jun 2011 01:20:25 -0400
> Austin Clements  wrote:
>
> Also, slightly reformat dir-locals.el so that the settings align and
> to make it friendlier for future additions.

Should we also add:

(tab-always-indent . nil)
(indent-tabs-mode  . t)

Otherwise the setups of people who normally use spaces will still
insert spaces when 'tab' is depressed.


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

2011-06-07 Thread Dima Kogan
> On Sun, 29 May 2011 01:56:44 -0700
> notmuch at dima.secretsauce.net wrote:
>
>  Here's another improvement. In the notmuch-show display this binds
> '[' to expand all the children messages (replies). Analogously ']'
> collapses all the children messages.

Here's an update of the patch to conform with notmuch's indentation style.
-- next part --
A non-text attachment was scrubbed...
Name: 0001-added-keys-to-hide-show-a-portion-of-the-thread.patch
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: 



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

2011-06-07 Thread Dima Kogan
> Notmuch uses a mix of 8 char width tabs and spaces.  First go tabs,
> then, if you need indenting with more precision, spaces.  Look at the
> lines your patch removes for an example.
> 
> Also, .dir-locals.el sets some variables to configure Emacs for
> Notmuch coding style but only for c-mode.  You may set it by hand for
> lisp.

Hi again. Here's the new patch, with M-n/M-p and tabbed indentation

dima
-- next part --
A non-text attachment was scrubbed...
Name: 0001-Added-M-n-and-M-p-to-cycle-through-previous-searches.patch
Type: text/x-patch
Size: 3698 bytes
Desc: not available
URL: 



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

2011-06-07 Thread Dima Kogan
 Notmuch uses a mix of 8 char width tabs and spaces.  First go tabs,
 then, if you need indenting with more precision, spaces.  Look at the
 lines your patch removes for an example.
 
 Also, .dir-locals.el sets some variables to configure Emacs for
 Notmuch coding style but only for c-mode.  You may set it by hand for
 lisp.

Hi again. Here's the new patch, with M-n/M-p and tabbed indentation

dimaFrom 70193e0a9f7451033fd0843d46ac40e5524b000b Mon Sep 17 00:00:00 2001
From: Dima Kogan d...@secretsauce.net
Date: Mon, 6 Jun 2011 23:15:26 -0700
Subject: [PATCH] Added M-n and M-p to cycle through previous searches

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

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 916cda1..035e551 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,26 @@ 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 +481,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 rest 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 rest ignore)
+   (notmuch-hello-search (widget-value widget)))
+			 :keymap (let ((map (make-sparse-keymap)))
+   (set-keymap-parent map widget-field-keymap)
+   (define-key map (kbd M-p) 'notmuch-hello-cyclerecent-prev)
+   (define-key map (kbd M-n) 'notmuch-hello-cyclerecent-next)
+   map)))
 	(widget-insert \n)
 
 	(when notmuch-hello-recent-searches
@@ -535,6 +567,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, M-n/M-p 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.5.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2011-06-07 Thread Dima Kogan
 On Sun, 29 May 2011 01:56:44 -0700
 notm...@dima.secretsauce.net wrote:

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

Here's an update of the patch to conform with notmuch's indentation style.
From 0e2ef657fe0f6e7f8f2f7e87acd1fbbf58d8d95d Mon Sep 17 00:00:00 2001
From: Dima Kogan d...@secretsauce.net
Date: Sun, 29 May 2011 00:37:55 -0700
Subject: [PATCH] added keys to hide/show a portion of the thread

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

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2ba151e..5ecf5ca 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,35 @@ 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.5.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Add dir-locals style variables for C++ and Elisp code.

2011-06-07 Thread Dima Kogan
 On Tue,  7 Jun 2011 01:20:25 -0400
 Austin Clements amdra...@mit.edu wrote:

 Also, slightly reformat dir-locals.el so that the settings align and
 to make it friendlier for future additions.

Should we also add:

(tab-always-indent . nil)
(indent-tabs-mode  . t)

Otherwise the setups of people who normally use spaces will still
insert spaces when 'tab' is depressed.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2011-06-04 Thread Dima Kogan
> On Sun, 29 May 2011 20:04:00 +0400
> Dmitry Kurochkin  wrote:
>
> Hi Dima.
> 
> On Sun, 29 May 2011 01:56:28 -0700, notmuch at dima.secretsauce.net
> wrote:
> > 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.
> > 
> 
> This sounds like a very nice improvement to me!  I just have one
> concern: Why C-up and C-down?  I believe M-p and M-n would be more
> natural for Emacs users (at least for me :)).
> 
> Also, I did not read the code and can not comment on it.  But notmuch
> coding style is to use tabs for indentation.  I guess .dir-locals.el
> should be improved to set coding style variables for all modes, not
> just C.
> 
> Regards,
>   Dmitry

Hi. I have a mild preference to C-up/down, but M-n/p is just fine also.
As for the coding style, I've looked through that file
(notmuch-hello.el), and it doesn't seem to have a consistent style as
far as tabs/spaces go. I'm happy to change my patch to conform, but I
don't know what I should be conforming to. Should I be tab-ing all
indents, or just some?



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

2011-06-04 Thread Dima Kogan
 On Sun, 29 May 2011 20:04:00 +0400
 Dmitry Kurochkin dmitry.kuroch...@gmail.com wrote:

 Hi Dima.
 
 On Sun, 29 May 2011 01:56:28 -0700, notm...@dima.secretsauce.net
 wrote:
  From: Dima Kogan d...@secretsauce.net
  
  ---
  
   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.
  
 
 This sounds like a very nice improvement to me!  I just have one
 concern: Why C-up and C-down?  I believe M-p and M-n would be more
 natural for Emacs users (at least for me :)).
 
 Also, I did not read the code and can not comment on it.  But notmuch
 coding style is to use tabs for indentation.  I guess .dir-locals.el
 should be improved to set coding style variables for all modes, not
 just C.
 
 Regards,
   Dmitry

Hi. I have a mild preference to C-up/down, but M-n/p is just fine also.
As for the coding style, I've looked through that file
(notmuch-hello.el), and it doesn't seem to have a consistent style as
far as tabs/spaces go. I'm happy to change my patch to conform, but I
don't know what I should be conforming to. Should I be tab-ing all
indents, or just some?

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch