unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch.el: add a hook to notmuch-reply
@ 2010-02-26 12:22 david
  2010-04-21 21:41 ` [PATCH v2] " David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: david @ 2010-02-26 12:22 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@unb.ca>

This patch introduces a variable notmuch-reply-hook and calls it using
run-hooks. This allows people to easily override the header setup and
so forth done by notmuch.
---

This is my solution to trying to rationalize the headers of 'm' versus 'r';
now I just call the same hook in both cases. There is actually only 2 lines 
of code added; the rest is a defcustom, docstrings and so on.

 notmuch.el |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6482170..f47f134 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -471,6 +471,8 @@ buffer."
       (progn
 	(insert "--text follows this line--")
 	(forward-line)))
+  (save-excursion
+    (run-hooks 'notmuch-reply-hook))
   (message-mode))
 
 (defun notmuch-show-reply ()
@@ -1107,6 +1109,14 @@ All currently available key bindings:
   :options '(hl-line-mode)
   :group 'notmuch)
 
+(defcustom notmuch-reply-hook nil
+  "List of functions to call when replying to a message.
+Run after the buffer content is returned from notmuch and before
+handing off to message mode. The function `notmuch-reply' runs
+this hook."
+  :type 'hook
+  :group 'notmuch)
+
 (defun notmuch-show-do-stash (text)
     (kill-new text)
     (message (concat "Saved: " text)))
-- 
1.6.5

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

* [PATCH v2] notmuch.el: add a hook to notmuch-reply
  2010-02-26 12:22 [PATCH] notmuch.el: add a hook to notmuch-reply david
@ 2010-04-21 21:41 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2010-04-21 21:41 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@unb.ca>

This patch introduces a variable notmuch-reply-hook and calls it using
run-hooks. This allows people to easily override the header setup and
so forth done by notmuch-reply.  In particular it allows harmonizing
the headers of message-mode and notmuch-reply.
---

Rebased against current master. The rework was inspired by current
discussion about how Bcc handling was broken in message-mode buffers
not generated by notmuch-reply.

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

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 66958a6..563fdc8 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -72,6 +72,14 @@ For example:
   :type '(alist :key-type (string) :value-type (string))
   :group 'notmuch)
 
+(defcustom notmuch-reply-hook nil
+  "List of functions to call when replying to a message.
+Run after the buffer content is returned from notmuch and before
+handing off to message mode. The function `notmuch-reply' runs
+this hook."
+  :type 'hook
+  :group 'notmuch)
+
 (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
   (let ((tag-list
 	 (with-output-to-string
@@ -124,6 +132,8 @@ For example:
       (progn
 	(insert "--text follows this line--")
 	(forward-line)))
+  (save-excursion
+    (run-hooks 'notmuch-reply-hook))
   (message-mode))
 
 (defun notmuch-documentation-first-line (symbol)
-- 
1.7.0

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-26 12:22 [PATCH] notmuch.el: add a hook to notmuch-reply david
2010-04-21 21:41 ` [PATCH v2] " David Bremner

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