From 5fdb13fd7273e9431001c68ad873ed54209b9ab9 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 11 Jul 2025 20:51:39 +0300 Subject: [PATCH] mu4e-draft: add mu4e-compose-jump-to-reasonable-place t by default (current behavior), but you can turn if off if your change (e.g. compose-hook) wants to put the point in some different place. --- NEWS.org | 4 ++++ mu4e/mu4e-draft.el | 13 ++++++++++++- mu4e/mu4e.texi | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS.org b/NEWS.org index 9e9c1542..caec9db9 100644 --- a/NEWS.org +++ b/NEWS.org @@ -180,6 +180,10 @@ - iCalendar support is a work-in-progress with the new editor. One change is that support is now _automatically_ available. + - 1.12.12: add a =defcustom= ~mu4e-compose-jump-to-a-reasonable-place~ for + customizing whether mu4e jumps to some "reasonable place" when opening the + message composition buffer. Default is ~t~, as the current behavior. + **** other - New command ~mu4e-search-query~ (bound to =c=) which lets you pick a query diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 57e0e6c5..ac333831 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -176,6 +176,16 @@ Also see `mu4e-context-policy'." :safe 'symbolp :group 'mu4e-compose) +(defcustom mu4e-compose-jump-to-a-reasonable-place t + "Put point at some reasonable place in the compose buffer? + +After the compose-buffer has been setup, mu4e can jump to some +reasonable place as per `mu4e--jump-to-a-reasonable-place'. If +you don't consider that reasonable, set to nil." + :type 'boolean + :safe 'booleanp + :group 'mu4e-compose) + ;; ;; display the ready-to-go display buffer in the desired way. ;; @@ -636,7 +646,8 @@ COMPOSE-TYPE and PARENT are as in `mu4e--draft'." (add-hook 'message-send-hook #'mu4e--compose-before-send nil t) (setq-local message-fcc-handler-function #'mu4e--fcc-handler) - (mu4e--jump-to-a-reasonable-place) + (when mu4e-compose-jump-to-a-reasonable-place + (mu4e--jump-to-a-reasonable-place)) (set-buffer-modified-p nil) (undo-boundary)) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 5ebbd1cf..7dd44ce3 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1939,6 +1939,11 @@ Or to something context-specific: (save-excursion (message-add-header "Bcc: account2@@example.com\n")))))))) @end lisp +By default, @t{mu4e} moves point to some ``reasonable place'' before letting you +edit the message; if you want something else, see +@code{mu4e-compose-jump-to-reasonable-place}. + + @noindent For a more general discussion about extending @t{mu4e}, see @ref{Extending mu4e}.