Wrapping up the 0.3 release

Dirk Hohndel hohndel at infradead.org
Sat Apr 24 15:50:27 PDT 2010


On Sat, 24 Apr 2010 15:05:55 -0700, Dirk Hohndel <hohndel at infradead.org> wrote:
> > Dirk also mentioned in IRC that there's a regression with the signature
> > being mispositioned before the quoted text with a reply buffer. Now that
> > I've added a signature, I'm noticing this as well.
> 
> Well - we don't seem to be adding the signature ourselves anymore... I
> still don't quite understand where and how we hand over to the existing
> message-mode functions - I why those decide to insert a signature at
> point.

Learning elisp every day. I think I now understand at least somewhat
what's happening there...
 
> Here's a trivial patch that ALSO adds a signature at the end of the
> message buffer (where it belongs). But I haven't figured out how to get
> rid of the one above the reply...
> 
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index acb7dbf..493cd0e 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -63,6 +63,7 @@
>      ;; line and then the body.
>      (with-temp-buffer
>        (call-process notmuch-command nil t nil "reply" query-string)
> +      (message-insert-signature)
>        (goto-char (point-min))
>        (if (re-search-forward "^$" nil t)
>  	  (save-excursion

This patch is of course completely bogus. But understanding why it was
bogus helped me come up with this patch, that hopefully makes more
sense. People who ACTUALLY understand elisp - please take a look

(I could have sworn there was a variable somewhere that gives me the
correct regex to search for a signature separator... but I can't find
it. so please replace '-- ' with that if you know)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index acb7dbf..05c9603 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -82,7 +82,13 @@
     (message-hide-headers)
     (save-excursion
       (goto-char (point-max))
-      (insert body))
+      (if (re-search-backward "-- " nil t)
+	  (progn 
+	    (forward-line -1)
+	    (insert body))
+	(progn
+	  (goto-char (point-max))
+	  (insert body))))
     (set-buffer-modified-p nil)))
 
 (defun notmuch-mua-forward-message ()


-- 
Dirk Hohndel
Intel Open Source Technology Center


More information about the notmuch mailing list