unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/2] Add filter to emacs show mode
@ 2012-04-25 17:12 Mark Walters
  2012-04-25 17:12 ` [PATCH v2 1/2] emacs: add a filter option to show Mark Walters
  2012-04-25 17:12 ` [PATCH v2 2/2] emacs: Bind filter in search to 'l' Mark Walters
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Walters @ 2012-04-25 17:12 UTC (permalink / raw)
  To: notmuch

This is a new version of
id:"1335309421-18893-1-git-send-email-markwalters1009@gmail.com" which
provides filtering or "limiting" function in emacs show mode.

Changes from the last version: move the binding to 'l' (mnemonic
"limit"), fixed an error if no new query string entered.

The second patch moves the keybinding for filter in search mode to 'l'
for consistency (let the bikeshedding begin!).

Best wishes

Mark




Mark Walters (2):
  emacs: add a filter option to show
  emacs: Bind filter in search to 'l'

 emacs/notmuch-show.el |   12 ++++++++++++
 emacs/notmuch.el      |    4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

-- 
1.7.9.1

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

* [PATCH v2 1/2] emacs: add a filter option to show
  2012-04-25 17:12 [PATCH v2 0/2] Add filter to emacs show mode Mark Walters
@ 2012-04-25 17:12 ` Mark Walters
  2012-04-26 18:21   ` Tomi Ollila
  2012-04-25 17:12 ` [PATCH v2 2/2] emacs: Bind filter in search to 'l' Mark Walters
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Walters @ 2012-04-25 17:12 UTC (permalink / raw)
  To: notmuch

Show the current thread with a different filter (i.e., open messages
in the thread matching the new query).

Bound to 'l' for "limit".

Note that it is not the same as filter in search mode as it replaces
the existing query rather than ANDing with it (but it does keep the
thread-id part of the query).
---
 emacs/notmuch-show.el |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 30b26d1..4b4d663 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -42,6 +42,7 @@
 (declare-function notmuch-search-next-thread "notmuch" nil)
 (declare-function notmuch-search-show-thread "notmuch" nil)
 (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))
+(declare-function notmuch-read-query "notmuch" (prompt))
 
 (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
   "Headers that should be shown in a message, in this order.
@@ -1157,6 +1158,7 @@ reset based on the original query."
 	(define-key map "s" 'notmuch-search)
 	(define-key map "m" 'notmuch-mua-new-mail)
 	(define-key map "f" 'notmuch-show-forward-message)
+	(define-key map "l" 'notmuch-show-filter-thread)
 	(define-key map "r" 'notmuch-show-reply-sender)
 	(define-key map "R" 'notmuch-show-reply)
 	(define-key map "|" 'notmuch-show-pipe-message)
@@ -1399,6 +1401,16 @@ current thread."
   "Mark the current message as read."
   (notmuch-show-tag-message "-unread"))
 
+(defun notmuch-show-filter-thread ()
+  "Filter or LIMIT the current thread based on a new query string.
+
+Reshows the current thread with matches defined by the new query-string."
+  (interactive)
+  (setq notmuch-show-query-context (notmuch-read-query "Filter thread: "))
+  (when (string= notmuch-show-query-context "")
+    (setq notmuch-show-query-context nil))
+  (notmuch-show-refresh-view t))
+
 ;; Functions for getting attributes of several messages in the current
 ;; thread.
 
-- 
1.7.9.1

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

* [PATCH v2 2/2] emacs: Bind filter in search to 'l'
  2012-04-25 17:12 [PATCH v2 0/2] Add filter to emacs show mode Mark Walters
  2012-04-25 17:12 ` [PATCH v2 1/2] emacs: add a filter option to show Mark Walters
@ 2012-04-25 17:12 ` Mark Walters
  2012-04-26 18:21   ` Tomi Ollila
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Walters @ 2012-04-25 17:12 UTC (permalink / raw)
  To: notmuch

Change the key binding for filter (or "limit") in search-mode. This
gives consistency with the new filter in show-mode, and frees 'f' for
forward-thread in the future.
---
 emacs/notmuch.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 736d00f..3df826c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -286,7 +286,7 @@ For a mouse binding, return nil."
     (define-key map "=" 'notmuch-search-refresh-view)
     (define-key map "G" 'notmuch-search-poll-and-refresh-view)
     (define-key map "t" 'notmuch-search-filter-by-tag)
-    (define-key map "f" 'notmuch-search-filter)
+    (define-key map "l" 'notmuch-search-filter)
     (define-key map [mouse-1] 'notmuch-search-show-thread)
     (define-key map "*" 'notmuch-search-tag-all)
     (define-key map "a" 'notmuch-search-archive-thread)
@@ -1095,7 +1095,7 @@ search."
   (notmuch-search-refresh-view))
 
 (defun notmuch-search-filter (query)
-  "Filter the current search results based on an additional query string.
+  "Filter or LIMIT the current search results based on an additional query string.
 
 Runs a new search matching only messages that match both the
 current search results AND the additional query string provided."
-- 
1.7.9.1

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

* Re: [PATCH v2 1/2] emacs: add a filter option to show
  2012-04-25 17:12 ` [PATCH v2 1/2] emacs: add a filter option to show Mark Walters
@ 2012-04-26 18:21   ` Tomi Ollila
  2012-04-26 19:10     ` Mark Walters
  0 siblings, 1 reply; 6+ messages in thread
From: Tomi Ollila @ 2012-04-26 18:21 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Wed, Apr 25 2012, Mark Walters <markwalters1009@gmail.com> wrote:

> Show the current thread with a different filter (i.e., open messages
> in the thread matching the new query).
>
> Bound to 'l' for "limit".
>
> Note that it is not the same as filter in search mode as it replaces
> the existing query rather than ANDing with it (but it does keep the
> thread-id part of the query).
> ---

LGTM -- just one question -- to be analogous with 'notmuch-search-filter'
'notmuch-show-filter-thread' could look something like:

(defun notmuch-show-filter-thread (query)
  "Filter or LIMIT the current thread based on a new query string.

Reshows the current thread with matches defined by the new query-string."
  (interactive (list (notmuch-read-query "Filter thread: ")))
  (setq notmuch-show-query-context (if (string= query "") nil query))
  (notmuch-show-refresh-view t))

?

Tomi

>  emacs/notmuch-show.el |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 30b26d1..4b4d663 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -42,6 +42,7 @@
>  (declare-function notmuch-search-next-thread "notmuch" nil)
>  (declare-function notmuch-search-show-thread "notmuch" nil)
>  (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))
> +(declare-function notmuch-read-query "notmuch" (prompt))
>  
>  (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
>    "Headers that should be shown in a message, in this order.
> @@ -1157,6 +1158,7 @@ reset based on the original query."
>  	(define-key map "s" 'notmuch-search)
>  	(define-key map "m" 'notmuch-mua-new-mail)
>  	(define-key map "f" 'notmuch-show-forward-message)
> +	(define-key map "l" 'notmuch-show-filter-thread)
>  	(define-key map "r" 'notmuch-show-reply-sender)
>  	(define-key map "R" 'notmuch-show-reply)
>  	(define-key map "|" 'notmuch-show-pipe-message)
> @@ -1399,6 +1401,16 @@ current thread."
>    "Mark the current message as read."
>    (notmuch-show-tag-message "-unread"))
>  
> +(defun notmuch-show-filter-thread ()
> +  "Filter or LIMIT the current thread based on a new query string.
> +
> +Reshows the current thread with matches defined by the new query-string."
> +  (interactive)
> +  (setq notmuch-show-query-context (notmuch-read-query "Filter thread: "))
> +  (when (string= notmuch-show-query-context "")
> +    (setq notmuch-show-query-context nil))
> +  (notmuch-show-refresh-view t))
> +
>  ;; Functions for getting attributes of several messages in the current
>  ;; thread.
>  
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH v2 2/2] emacs: Bind filter in search to 'l'
  2012-04-25 17:12 ` [PATCH v2 2/2] emacs: Bind filter in search to 'l' Mark Walters
@ 2012-04-26 18:21   ` Tomi Ollila
  0 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2012-04-26 18:21 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Wed, Apr 25 2012, Mark Walters wrote:

> Change the key binding for filter (or "limit") in search-mode. This
> gives consistency with the new filter in show-mode, and frees 'f' for
> forward-thread in the future.
> ---

LGTM.

Tomi


>  emacs/notmuch.el |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 736d00f..3df826c 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -286,7 +286,7 @@ For a mouse binding, return nil."
>      (define-key map "=" 'notmuch-search-refresh-view)
>      (define-key map "G" 'notmuch-search-poll-and-refresh-view)
>      (define-key map "t" 'notmuch-search-filter-by-tag)
> -    (define-key map "f" 'notmuch-search-filter)
> +    (define-key map "l" 'notmuch-search-filter)
>      (define-key map [mouse-1] 'notmuch-search-show-thread)
>      (define-key map "*" 'notmuch-search-tag-all)
>      (define-key map "a" 'notmuch-search-archive-thread)
> @@ -1095,7 +1095,7 @@ search."
>    (notmuch-search-refresh-view))
>  
>  (defun notmuch-search-filter (query)
> -  "Filter the current search results based on an additional query string.
> +  "Filter or LIMIT the current search results based on an additional query string.
>  
>  Runs a new search matching only messages that match both the
>  current search results AND the additional query string provided."
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH v2 1/2] emacs: add a filter option to show
  2012-04-26 18:21   ` Tomi Ollila
@ 2012-04-26 19:10     ` Mark Walters
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2012-04-26 19:10 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

On Thu, 26 Apr 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, Apr 25 2012, Mark Walters <markwalters1009@gmail.com> wrote:
>
>> Show the current thread with a different filter (i.e., open messages
>> in the thread matching the new query).
>>
>> Bound to 'l' for "limit".
>>
>> Note that it is not the same as filter in search mode as it replaces
>> the existing query rather than ANDing with it (but it does keep the
>> thread-id part of the query).
>> ---
>
> LGTM -- just one question -- to be analogous with 'notmuch-search-filter'
> 'notmuch-show-filter-thread' could look something like:
>
> (defun notmuch-show-filter-thread (query)
>   "Filter or LIMIT the current thread based on a new query string.
>
> Reshows the current thread with matches defined by the new query-string."
>   (interactive (list (notmuch-read-query "Filter thread: ")))
>   (setq notmuch-show-query-context (if (string= query "") nil query))
>   (notmuch-show-refresh-view t))
>

Oh that looks much nicer! I will resubmit.

Best wishes

Mark

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

end of thread, other threads:[~2012-04-26 19:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 17:12 [PATCH v2 0/2] Add filter to emacs show mode Mark Walters
2012-04-25 17:12 ` [PATCH v2 1/2] emacs: add a filter option to show Mark Walters
2012-04-26 18:21   ` Tomi Ollila
2012-04-26 19:10     ` Mark Walters
2012-04-25 17:12 ` [PATCH v2 2/2] emacs: Bind filter in search to 'l' Mark Walters
2012-04-26 18:21   ` Tomi Ollila

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