unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Reuse rather than reinvent message header filtering
@ 2010-04-29  8:47 Sebastian Spaeth
  2010-04-29  9:00 ` David Edmondson
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Spaeth @ 2010-04-29  8:47 UTC (permalink / raw)
  To: Notmuch developer list

In notmuch-mua-reply we were filtering out the Subject and To headers
manually in a loop, but message mode offers a nice function for
exactly that. Simplify the code by using that. Also, as
notmuch-mua-mail already sorts and hides headers that we want sorted
and hidden, we can safely remove those 2 functions from here as well.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
---
 emacs/notmuch-mua.el |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index bd06e3c..6318c15 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -92,12 +92,7 @@ list."
 	((same-window-regexps '("\\*mail .*")))
       (notmuch-mua-mail (mail-header 'to headers)
 			(mail-header 'subject headers)
-			(loop for header in headers
-			      if (not (or (eq 'to (car header))
-					  (eq 'subject (car header))))
-			      collect header)))
-    (message-sort-headers)
-    (message-hide-headers)
+			(message-headers-to-generate headers t '(to subject))))
     ;; insert the message body - but put it in front of the signature
     ;; if one is present
     (goto-char (point-max))
-- 
1.7.0.4

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

* Re: [PATCH] emacs: Reuse rather than reinvent message header filtering
  2010-04-29  8:47 [PATCH] emacs: Reuse rather than reinvent message header filtering Sebastian Spaeth
@ 2010-04-29  9:00 ` David Edmondson
  2010-04-29  9:10   ` [PATCH v2] " Sebastian Spaeth
  0 siblings, 1 reply; 4+ messages in thread
From: David Edmondson @ 2010-04-29  9:00 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch developer list

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

On Thu, 29 Apr 2010 10:47:55 +0200, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:
> In notmuch-mua-reply we were filtering out the Subject and To headers
> manually in a loop, but message mode offers a nice function for
> exactly that. Simplify the code by using that. Also, as
> notmuch-mua-mail already sorts and hides headers that we want sorted
> and hidden, we can safely remove those 2 functions from here as well.
> 
> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>

This looks fine to me (I even tested!).

We can also remove "(require 'cl)" now that the use of `loop' is gone.

dme.
-- 
David Edmondson, http://dme.org

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

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

* [PATCH v2] emacs: Reuse rather than reinvent message header filtering
  2010-04-29  9:00 ` David Edmondson
@ 2010-04-29  9:10   ` Sebastian Spaeth
  2010-06-04  0:06     ` Carl Worth
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Spaeth @ 2010-04-29  9:10 UTC (permalink / raw)
  To: Notmuch developer list

In notmuch-mua-reply we were filtering out the Subject and To headers
manually in a loop, but message mode offers a nice function for
exactly that. Simplify the code by using it. Also, as notmuch-mua-mail
already sorts and hides headers that we want sorted and hidden, we can
safely remove those 2 functions from here as well.  Also remove the
(require 'cl), the only reason for its existence was the now removed
"loop" function.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
---
 Also removed (require 'cl) as per dme's suggestion.

 emacs/notmuch-mua.el |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index bd06e3c..0975fe6 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -19,7 +19,6 @@
 ;;
 ;; Authors: David Edmondson <dme@dme.org>
 
-(require 'cl)
 (require 'message)
 
 (require 'notmuch-lib)
@@ -92,12 +91,7 @@ list."
 	((same-window-regexps '("\\*mail .*")))
       (notmuch-mua-mail (mail-header 'to headers)
 			(mail-header 'subject headers)
-			(loop for header in headers
-			      if (not (or (eq 'to (car header))
-					  (eq 'subject (car header))))
-			      collect header)))
-    (message-sort-headers)
-    (message-hide-headers)
+			(message-headers-to-generate headers t '(to subject))))
     ;; insert the message body - but put it in front of the signature
     ;; if one is present
     (goto-char (point-max))
-- 
1.7.0.4

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

* Re: [PATCH v2] emacs: Reuse rather than reinvent message header filtering
  2010-04-29  9:10   ` [PATCH v2] " Sebastian Spaeth
@ 2010-06-04  0:06     ` Carl Worth
  0 siblings, 0 replies; 4+ messages in thread
From: Carl Worth @ 2010-06-04  0:06 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch developer list

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

On Thu, 29 Apr 2010 11:10:01 +0200, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:
> In notmuch-mua-reply we were filtering out the Subject and To headers
> manually in a loop, but message mode offers a nice function for
> exactly that. Simplify the code by using it. Also, as notmuch-mua-mail
> already sorts and hides headers that we want sorted and hidden, we can
> safely remove those 2 functions from here as well.  Also remove the
> (require 'cl), the only reason for its existence was the now removed
> "loop" function.
> 
> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
> ---
>  Also removed (require 'cl) as per dme's suggestion.

Lovely. Thanks for the patch, Sebastian, (and for the review, David).

I've committed this and expect to push it soon.

-Carl

-- 
carl.d.worth@intel.com

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

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

end of thread, other threads:[~2010-06-04  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-29  8:47 [PATCH] emacs: Reuse rather than reinvent message header filtering Sebastian Spaeth
2010-04-29  9:00 ` David Edmondson
2010-04-29  9:10   ` [PATCH v2] " Sebastian Spaeth
2010-06-04  0:06     ` Carl Worth

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