unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply
@ 2013-08-28 19:34 Jani Nikula
  2013-08-28 19:34 ` [PATCH 1/2] emacs: simplify point placement for inserting message body on reply Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jani Nikula @ 2013-08-28 19:34 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila, Geoffrey Ferrari

This is an alternative to [1]. I tried to dig through history, and I
couldn't find a decent reason for having the backwards regexp in place.

BR,
Jani.


[1] id:1375961732-14327-1-git-send-email-geoffrey.ferrari@oriel.oxon.org


Jani Nikula (2):
  emacs: simplify point placement for inserting message body on reply
  emacs: slightly cleanup the reply code

 emacs/notmuch-mua.el |   45 ++++++++++++++++++++-------------------------
 1 file changed, 20 insertions(+), 25 deletions(-)

-- 
1.7.10.4

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

* [PATCH 1/2] emacs: simplify point placement for inserting message body on reply
  2013-08-28 19:34 [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Jani Nikula
@ 2013-08-28 19:34 ` Jani Nikula
  2013-08-28 19:34 ` [PATCH 2/2] emacs: slightly cleanup the reply code Jani Nikula
  2013-09-03 15:30 ` [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Tomi Ollila
  2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2013-08-28 19:34 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila, Geoffrey Ferrari

The backwards regexp was most likely just old cruft. Simply put the
point at the beginning of message body. It's guaranteed to be before
the signature.
---
 emacs/notmuch-mua.el |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baae5f..a4be394 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -190,12 +190,8 @@ list."
 			    (notmuch-headers-plist-to-alist reply-headers)
 			    nil (notmuch-mua-get-switch-function))))
 
-      ;; Insert the message body - but put it in front of the signature
-      ;; if one is present
-      (goto-char (point-max))
-      (if (re-search-backward message-signature-separator nil t)
-	  (forward-line -1)
-	(goto-char (point-max)))
+      ;; Move point to the beginning of the message body.
+      (message-goto-body)
 
       (let ((from (plist-get original-headers :From))
 	    (date (plist-get original-headers :Date))
-- 
1.7.10.4

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

* [PATCH 2/2] emacs: slightly cleanup the reply code
  2013-08-28 19:34 [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Jani Nikula
  2013-08-28 19:34 ` [PATCH 1/2] emacs: simplify point placement for inserting message body on reply Jani Nikula
@ 2013-08-28 19:34 ` Jani Nikula
  2013-09-03 15:30 ` [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Tomi Ollila
  2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2013-08-28 19:34 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila, Geoffrey Ferrari

Since the starting point for the original message can now be found
with the simple (message-goto-body), there's no need to save
point. Drop the extra let block. No functional changes.
---
 emacs/notmuch-mua.el |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index a4be394..c800250 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -193,24 +193,23 @@ list."
       ;; Move point to the beginning of the message body.
       (message-goto-body)
 
-      (let ((from (plist-get original-headers :From))
-	    (date (plist-get original-headers :Date))
-	    (start (point)))
-
-	;; message-cite-original constructs a citation line based on the From and Date
-	;; headers of the original message, which are assumed to be in the buffer.
-	(insert "From: " from "\n")
-	(insert "Date: " date "\n\n")
-
-	;; Get the parts of the original message that should be quoted; this includes
-	;; all the text parts, except the non-preferred ones in a multipart/alternative.
-	(let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
-	  (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))
-
-	(set-mark (point))
-	(goto-char start)
-	;; Quote the original message according to the user's configured style.
-	(message-cite-original))))
+      ;; message-cite-original constructs a citation line based on the
+      ;; From and Date headers of the original message, which are
+      ;; assumed to be in the buffer.
+      (insert "From: " (plist-get original-headers :From) "\n")
+      (insert "Date: " (plist-get original-headers :Date) "\n\n")
+
+      ;; Get the parts of the original message that should be quoted;
+      ;; this includes all the text parts, except the non-preferred
+      ;; ones in a multipart/alternative.
+      (let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
+	(mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))))
+
+  ;; Quote the original message according to the user's configured
+  ;; style.
+  (set-mark (point))
+  (message-goto-body)
+  (message-cite-original)
 
   (goto-char (point-max))
   (push-mark)
-- 
1.7.10.4

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

* Re: [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply
  2013-08-28 19:34 [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Jani Nikula
  2013-08-28 19:34 ` [PATCH 1/2] emacs: simplify point placement for inserting message body on reply Jani Nikula
  2013-08-28 19:34 ` [PATCH 2/2] emacs: slightly cleanup the reply code Jani Nikula
@ 2013-09-03 15:30 ` Tomi Ollila
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2013-09-03 15:30 UTC (permalink / raw)
  To: Jani Nikula, notmuch; +Cc: Geoffrey Ferrari

On Wed, Aug 28 2013, Jani Nikula <jani@nikula.org> wrote:

> This is an alternative to [1]. I tried to dig through history, and I
> couldn't find a decent reason for having the backwards regexp in place.

I played a bit with this and this works fine. Looks good & tests pass. +1

>
> BR,
> Jani.

Tomi

>
>
> [1] id:1375961732-14327-1-git-send-email-geoffrey.ferrari@oriel.oxon.org
>
>
> Jani Nikula (2):
>   emacs: simplify point placement for inserting message body on reply
>   emacs: slightly cleanup the reply code
>
>  emacs/notmuch-mua.el |   45 ++++++++++++++++++++-------------------------
>  1 file changed, 20 insertions(+), 25 deletions(-)
>
> -- 
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

-- 
"kaik on mänt!"

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

end of thread, other threads:[~2013-09-03 15:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-28 19:34 [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply Jani Nikula
2013-08-28 19:34 ` [PATCH 1/2] emacs: simplify point placement for inserting message body on reply Jani Nikula
2013-08-28 19:34 ` [PATCH 2/2] emacs: slightly cleanup the reply code Jani Nikula
2013-09-03 15:30 ` [PATCH 0/2] emacs: simplify and cleanup notmuch-mua-reply 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).