From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +K97Ds2ltF6SLAAA0tVLHw (envelope-from ) for ; Fri, 08 May 2020 00:20:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6CL8JdmltF6mDgAAbx9fmQ (envelope-from ) for ; Fri, 08 May 2020 00:20:41 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E1030940C73 for ; Fri, 8 May 2020 00:20:38 +0000 (UTC) Received: from localhost ([::1]:35768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWqko-00017U-2i for larch@yhetil.org; Thu, 07 May 2020 20:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWqkP-00017D-81 for emacs-orgmode@gnu.org; Thu, 07 May 2020 20:20:13 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:32969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWqkN-0004lK-Pi for emacs-orgmode@gnu.org; Thu, 07 May 2020 20:20:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CA9B65C01E0; Thu, 7 May 2020 20:20:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 07 May 2020 20:20:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imapmail.org; h= from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=nAe4kKkkvNpDIqm2G1xHfRtbEILK01hzxQe5y8ndqyE=; b=Gv7KKQ00 hAWQWJL658xOIXwXtGjY9DskuQSUQDpkwyhoJx5fQ4uwqPDCttr3eaMXd+WehI3L bYGFHzVfbneo+YTg76KHyHPkhT4g7zRb2G93o24l79FGelbNY6Th5+lUbJSx2PuT SPIGPkcWaBIxVlBaukHFiilZISJZQXPUDR2x3pynsMb2vKgNnxXhUsYXYZ8CctJo 4A6RHhUopjzZZIh2gg4JYkzSTc3P6XEIrVIScOv1bovhG0aM/Bb8XjkFz6PVcOAX QgpaYkucQxvIJRxD0ZmY9RUQAzhXDlZtzzDE6QHw4nUKJd9fKP7Cuo/ByLc/9+0z aPR0KUreVIHguQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=nAe4kKkkvNpDIqm2G1xHfRtbEILK0 1hzxQe5y8ndqyE=; b=ushaOW5vS72XJ4VH4RchcYWTaMiMdWzY6NVnCfNsV4uf8 D7Jd2W6FaOIE7pa17yMD1o8OCa1EXkE0Yql+yYMNBqgol4Qf/ia2sUZ9E5K4RY5R nRp9aX+2+qK/f9mXxPoQ03LCt7+ouyzqZDOSU88oMAOXngGgw4ccq0QlofVnKdoN XM6sh5iiIQA57Vq2RWVcnhHZ/GiY8Mfe1sLurnmkhHsQy7ZN4e14QdCughhyFEXD oDv4SOQsVuXpmI5y18gGYRtjGFKic8qmzT7iUVNCJWfGZCs45NuEAunjcxeQBUoJ 6Hl/M4pTYqQqj1/1jrO/lIwKpg6ec8SNmF5zvNbvw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkedugdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkgggtsehmtderredttddtnecuhfhrohhmpeforghtthcunfhunhgu ihhnuceomhgulhesihhmrghpmhgrihhlrdhorhhgqeenucggtffrrghtthgvrhhnpeehtd ffffevuefhffehgfefieffleevjeffueffuefhgeetgeekveefhfegveefueenucfkphep jeeirdduiedrudefhedrudduleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehmughlsehimhgrphhmrghilhdrohhrgh X-ME-Proxy: Received: from localhost (c-76-16-135-119.hsd1.il.comcast.net [76.16.135.119]) by mail.messagingengine.com (Postfix) with ESMTPA id 72737328006B for ; Thu, 7 May 2020 20:20:10 -0400 (EDT) From: Matt Lundin To: Org Mode List Subject: [PATCH] Fix moving cursor in org-set-tags-command Date: Thu, 07 May 2020 19:20:09 -0500 Message-ID: <871rnvi8g6.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=66.111.4.27; envelope-from=mdl@imapmail.org; helo=out3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 20:20:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=imapmail.org header.s=fm3 header.b=Gv7KKQ00; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=ushaOW5v; dmarc=pass (policy=none) header.from=imapmail.org; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.71 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49852164274234]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail,imapmail.org:server fail]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; FREEMAIL_FROM(0.00)[imapmail.org]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.10), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; DKIM_TRACE(0.00)[imapmail.org:+,messagingengine.com:+]; DMARC_POLICY_ALLOW(-0.50)[imapmail.org,none]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[76.16.135.119:received]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[mdl@imapmail.org,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[imapmail.org:s=fm3,messagingengine.com:s=fm2]; URIBL_BLOCKED(0.00)[messagingengine.com:dkim,imapmail.org:dkim]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[2001:470:142::17:from]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: gQAZe8VYFYO4 --=-=-= Content-Type: text/plain Commit 44ec473c199262d89b372d8a6cd35bed7672164d from Feb. 23 causes org-set-tags-command to move the cursor forward 1 char when situated on headline asterisks. So if I am on the following level 1 headline with the cursor on the asterisk as below... * Headline ^ ...and I call org-set-tags command, it moves the cursor forward one space: * Headline :tag: ^ This is causes problems with org-speed-keys, which requires that the cursor remain on the headline. This commit modified a previous change on Feb. 21 (450452de4b790706d187291f9f71a286f8f62004). But that commit also had problems, since it would move the cursor one asterisk forward on headlines > 1, thus also interfering with org-speed-keys. In my view org-set-tags-command should not move the cursor except to fix the very specific thing that commit 450452de4b was meant to fix: namely the cursor moving when on a blank headline: i.e., from here... *** ^ ...to here... *** :tag: ^ I've attached a patch that corrects the problem, but it would be ideal if we figured out why the cursor is moving in the first place. Best, Matt --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-bug-that-placed-cursor-incorrectly-when-setting-.patch >From ae5cf0e1110241426e49f573219e9740c25bf8ea Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Thu, 7 May 2020 19:06:08 -0500 Subject: [PATCH 1/1] Fix bug that placed cursor incorrectly when setting tags * lisp/org.el: (org-set-tags-command) Only fix cursor position in very specific circumstances (i.e., when cursor is on an empty headline). --- lisp/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index dd017e662..0e4fd7be1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11846,8 +11846,9 @@ in Lisp code use `org-set-tags' instead." (org-set-tags tags))))) ;; `save-excursion' may not replace the point at the right ;; position. - (when (save-excursion (skip-chars-backward "*") (bolp)) - (forward-char)))) + (and (looking-at " ") + (string-match "\\*+" (buffer-substring (point-at-bol) (point))) + (forward-char)))) (defun org-align-tags (&optional all) "Align tags in current entry. -- 2.26.2 --=-=-=--