From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EAZ9NUfDl2JGSgEAbAwnHQ (envelope-from ) for ; Wed, 01 Jun 2022 21:51:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CKiENEfDl2LaAwAAG6o9tA (envelope-from ) for ; Wed, 01 Jun 2022 21:51:35 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 896A7AAD for ; Wed, 1 Jun 2022 21:51:35 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id CAB415F7B4; Wed, 1 Jun 2022 19:51:32 +0000 (UTC) Received: from mail.choca.pics (mail.choca.pics [80.67.172.235]) by mail.notmuchmail.org (Postfix) with ESMTPS id F379B5F7B0 for ; Wed, 1 Jun 2022 19:51:30 +0000 (UTC) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 4362718193F5F for ; Wed, 1 Jun 2022 21:51:30 +0200 (CEST) Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id J1QWswoYticH; Wed, 1 Jun 2022 21:51:29 +0200 (CEST) Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 86EE818193F5B; Wed, 1 Jun 2022 21:51:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id LSHui6fTsiCG; Wed, 1 Jun 2022 21:51:29 +0200 (CEST) Received: from localhost (153.226.95.79.rev.sfr.net [79.95.226.153]) by mail.choca.pics (Postfix) with ESMTPSA id 3D13C18193F59; Wed, 1 Jun 2022 21:51:29 +0200 (CEST) From: Damien Cassou To: notmuch@notmuchmail.org Subject: [PATCH v2] emacs: change where notmuch-mua-mail moves point Date: Wed, 1 Jun 2022 21:50:48 +0200 Message-Id: <20220601195048.166397-1-damien@cassou.me> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Message-ID-Hash: CTQE4OJPAVLHWKSGQMJANOKK3B3C4K7N X-Message-ID-Hash: CTQE4OJPAVLHWKSGQMJANOKK3B3C4K7N X-MailFrom: damien@cassou.me X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 CC: Damien Cassou X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654113095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=eu1HngmP+iRxR8JrvK0A5De3Co+VaN5G42GYMn2xxq4=; b=t6fFJd1hegQf3HedR6UNR2pT9pNYRFs9265d/Esr0eAI1q6WWh9OHDYJkUIiu9jtqnvT4V lfs1kf/XswK2E8AxsstzI5oKDxhmDdxWW6B6OjIecInJjNBKaYOzL187dmMjYfQh9DYhFL VkSbvvZpx+44LiYv+cLt++O79Siok3lNOL9pysxh7nBGfZzwJlxAkN+ZEKw8QJNlG8Xwe9 pQU5pbhezrQXL7Rm1jm1O1lqRxOoz099dCMqDqs6GyXiAwmSF/OAbwyHz3AVU4WHAWZlWt 93W3voL+8B0SKRBJw43l9rAd3SMPD0qQBIQGDnTlkR/U7R5E2fv9NXHaCfl/Yg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654113095; a=rsa-sha256; cv=none; b=Uk6ugVM94FkvxZhZLGcg8D72P3N6+F5b7uWcKsUlP6DY+NsJyZJclLrop9uGQnnAvgmWk9 46iMiaqmBRg93V07n9YFjRvBktwy3y151b7rYekjBV0Pa9wlxIvp2jrhPhEVNfJ5zNXGTs gmeyefBhJ3RvR1aoAqPf08srmmKDrVjWLfAQK0q4eQ6tyYLePQVKyq2oNvogtHNilb3ZDb 6J9miJqA5AfbpKR0dZKxUb76muBE7UgjcrLtvg4GRNvrnRY/wzhIS0knrEU9FfwdT4KOpN tPEpNR+JBhu515AM5rjkna7mbDus3POwXM04q/yaZdJneujnA+/HGCPe2naVYA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.04 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 896A7AAD X-Spam-Score: -2.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: EOqbZkwfPC8J 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