emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: emacs-orgmode@gnu.org
Subject: Bug: org-set-tags-command deletes inherited tags [9.3.7 (9.3.7-18-g093b47-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20200810/)]
Date: Tue, 18 Aug 2020 15:42:23 -0700	[thread overview]
Message-ID: <80a6yry3sg.fsf@felesatra.moe> (raw)

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]


Example Org file:

* Parent :foo:bar:baz:
** Child :foo:bar:spam:

Invoking org-set-tags-command with point on Child prepopulates the
minibuffer prompt with only the tags :spam:

This is because org-get-tags doesn't distinguish between inherited only
tags and inherited tags which are also explicitly set on a heading, so
org-set-tags-command treats :foo:bar: as inherited only rather than also
set locally on the heading.

This is undesirable because having tags set directly on a heading has
different semantics even if they are also inherited (e.g., the TAGS
special property, or when headings will be refiled to a different
location later).

Attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Don-t-exclude-local-tags-that-are-also-inheri.patch --]
[-- Type: text/x-patch, Size: 975 bytes --]

From 934d65537e46c68c10edbfa2d7140cebfe89d271 Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Tue, 18 Aug 2020 15:34:38 -0700
Subject: [PATCH] org.el: Don't exclude local tags that are also inherited

* lisp/org.el (org-set-tags-command): Don't exclude local tags even if inherited.
---
 lisp/org.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index fb95590fc..49d7d24f2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11880,9 +11880,7 @@ in Lisp code use `org-set-tags' instead."
 				  (org-global-tags-completion-table
 				   (org-agenda-files)))
 			     (or org-current-tag-alist (org-get-buffer-tags)))))
-	       (current-tags
-		(cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
-			      all-tags))
+	       (current-tags (org-get-tags nil t))
 	       (inherited-tags
 		(cl-remove-if-not (lambda (tag) (get-text-property 0 'inherited tag))
 				  all-tags))
-- 
2.28.0


[-- Attachment #3: Type: text/plain, Size: 210 bytes --]


Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22)
 of 2020-08-11
Package: Org mode version 9.3.7 (9.3.7-18-g093b47-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20200810/)

             reply	other threads:[~2020-08-18 22:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 22:42 Allen Li [this message]
2020-08-19  4:43 ` Bug: org-set-tags-command deletes inherited tags [9.3.7 (9.3.7-18-g093b47-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20200810/)] Kyle Meyer
2020-08-21  8:39   ` Allen Li
2020-08-22  9:03     ` Allen Li
2020-08-24  2:43       ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80a6yry3sg.fsf@felesatra.moe \
    --to=darkfeline@felesatra.moe \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).