From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damian Subject: Re: Bug: missing `save-excursion' in `org-fast-tag-selection' [9.2.3 (9.2.3-9-g0803e2-elpa @ /home/il/.emacs.d/elpa/org-20190422/)] Date: Wed, 1 May 2019 09:03:37 -0700 Message-ID: <6e5d946f-398f-346a-eeaa-2e0729d631e8@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:43528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLrhw-0003Sn-Vw for emacs-orgmode@gnu.org; Wed, 01 May 2019 12:03:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLrht-0000HN-TG for emacs-orgmode@gnu.org; Wed, 01 May 2019 12:03:44 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:41229) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLrht-0000Fo-NV for emacs-orgmode@gnu.org; Wed, 01 May 2019 12:03:41 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9so8374723pls.8 for ; Wed, 01 May 2019 09:03:41 -0700 (PDT) Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org, mail@nicolasgoaziou.fr Ingo Lohmar writes: > I tried to use `org-agenda-set-tags'.  The source buffer (where the > change should be applied) is visible at the same time as the agenda is. > Also, fast tag selection with a single key is enabled. > > Under these circumstances, the tag text is appended to the line (not > even necessarily a heading!) where point is in the source buffer visible > next to the agenda, instead of the correct heading that I acted upon. > > I tracked this done to a missing `save-excursion' wrapped around the > `save-window-excursion' in `org-fast-tag-selection' (org.el line 14567 > in my version).  This would be analogous to what is done in > `org-fast-todo-selection' and fixes my issue. I am experiencing the same issue. Based on Ingo's analysis I made the following change which resolved the problem for me. Thanks, -Damian diff --git a/lisp/org.el b/lisp/org.el index 94713a7e5..3f2bd5758 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12484,6 +12484,7 @@ Returns the new tags string, or nil to not change the current settings."                    " "                  (make-string (- org-tags-column (current-column)) ?\ ))))))      (move-overlay org-tags-overlay ov-start ov-end) +    (save-excursion      (save-window-excursion        (if expert           (set-buffer (get-buffer-create " *Org tags*")) @@ -12645,7 +12646,7 @@ Returns the new tags string, or nil to not change the current settings."        (delete-overlay org-tags-overlay)        (if rtn           (mapconcat 'identity current ":") -   nil)))) +        nil)))))  (defun org-make-tag-string (tags)    "Return string associated to TAGS.