unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] emacs: change where notmuch-mua-mail moves point
@ 2022-06-01 19:50 Damien Cassou
  2022-06-02 11:24 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Cassou @ 2022-06-01 19:50 UTC (permalink / raw)
  To: notmuch; +Cc: Damien Cassou

Move point to the position that makes the most sense instead of always
moving point to the TO.  This is useful when TO/SUBJECT are passed as
argument.

---

- Explain new behavior in docstring
- Add NEWS entry
- Fix commit message to follow notmuch guidelines
- Use git-send-email

Previous version in <87zgj8zs3k.fsf@cassou.me>
---
 NEWS                 |  3 +++
 emacs/notmuch-mua.el | 13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index c18d63d3..6646e307 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,9 @@ Bind the usual undo key sequences to new command
 "notmuch-tag-undo". This allows transparent undo of tagging
 operations.
 
+The function `notmuch-mua-mail` now moves point depending on the
+provided arguments.
+
 Tests
 -----
 
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 60801f4b..0ae33127 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -385,7 +385,13 @@ (defun notmuch-mua-pop-to-buffer (name switch-function)
 (defun notmuch-mua-mail (&optional to subject other-headers _continue
 				   switch-function yank-action send-actions
 				   return-action &rest ignored)
-  "Invoke the notmuch mail composition window."
+  "Invoke the notmuch mail composition window.
+
+The position of point when the function returns differs depending
+on the values of TO and SUBJECT.  If both are non-nil, point is
+moved to the message's body.  If SUBJECT is nil but TO isn't,
+point is moved to the \"Subject:\" header.  Otherwise, point is
+moved to the \"To:\" header."
   (interactive)
   (when notmuch-mua-user-agent-function
     (let ((user-agent (funcall notmuch-mua-user-agent-function)))
@@ -420,7 +426,10 @@ (defun notmuch-mua-mail (&optional to subject other-headers _continue
   (message-hide-headers)
   (set-buffer-modified-p nil)
   (notmuch-mua-maybe-set-window-dedicated)
-  (message-goto-to))
+  (cond
+   ((and to subject) (message-goto-body))
+   (to (message-goto-subject))
+   (t (message-goto-to))))
 
 (defvar notmuch-mua-sender-history nil)
 
-- 
2.36.0

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

* Re: [PATCH v2] emacs: change where notmuch-mua-mail moves point
  2022-06-01 19:50 [PATCH v2] emacs: change where notmuch-mua-mail moves point Damien Cassou
@ 2022-06-02 11:24 ` David Bremner
  2022-06-02 15:07   ` Damien Cassou
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2022-06-02 11:24 UTC (permalink / raw)
  To: Damien Cassou, notmuch; +Cc: Damien Cassou

Damien Cassou <damien@cassou.me> writes:

> Move point to the position that makes the most sense instead of always
> moving point to the TO.  This is useful when TO/SUBJECT are passed as
> argument.
>

This version was OK, except NEWS should not be added to already released
versions. I fixed that and applied the result to master.

d

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

* Re: [PATCH v2] emacs: change where notmuch-mua-mail moves point
  2022-06-02 11:24 ` David Bremner
@ 2022-06-02 15:07   ` Damien Cassou
  2022-06-02 15:29     ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Cassou @ 2022-06-02 15:07 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:
> This version was OK, except NEWS should not be added to already released
> versions. I fixed that and applied the result to master.

Thank you very much. I didn't know that 0.36 was released. I'm packaging
that for Nix: https://github.com/NixOS/nixpkgs/pull/175933.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

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

* Re: [PATCH v2] emacs: change where notmuch-mua-mail moves point
  2022-06-02 15:07   ` Damien Cassou
@ 2022-06-02 15:29     ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2022-06-02 15:29 UTC (permalink / raw)
  To: Damien Cassou, notmuch

Damien Cassou <damien@cassou.me> writes:

> David Bremner <david@tethera.net> writes:
>> This version was OK, except NEWS should not be added to already released
>> versions. I fixed that and applied the result to master.
>
> Thank you very much. I didn't know that 0.36 was released. I'm packaging
> that for Nix: https://github.com/NixOS/nixpkgs/pull/175933.
>

In principle it should always say UNRELEASED at the top of NEWS
otherwise. I don't think that's documented anywhere though.

d

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

end of thread, other threads:[~2022-06-02 15:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 19:50 [PATCH v2] emacs: change where notmuch-mua-mail moves point Damien Cassou
2022-06-02 11:24 ` David Bremner
2022-06-02 15:07   ` Damien Cassou
2022-06-02 15:29     ` 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).