Re: [O] Make tag inheritance explicit
* Kaushal Modiwrote: > > On Tue, Jan 23, 2018 at 9:45 AM Karl Voit wrote: > >> > 2. Use `org-get-tags-at' with point on "Task 1" heading in your example. >> > `org-get-tags' returns a list of tags *only* at the current heading. >> > `org-get-tags-at' returns inherited tags too. >> >> You mean for developing a custom-made function that provides the >> feature I was asking for? > > By "feature", you mean copying all the inherited tags to the heading at > point? Yes. With your help, I wrote: (defun my-set-tags-including-inherited () (interactive) (let ( (alltags (org-get-tags-at)) ) (org-set-tags-to alltags) ) ) Which provides me "the feature" I was looking for. It can be simplified, I know. However, I tried to add a list of tags I *don't* want to be added to the heading but failed so far. alltags content example: (#("test1" 0 5 (inherited t)) #("foobar" 0 6 (inherited t)) #("test2" 0 5 (inherited t)) #("baz" 0 3 (inherited t))) Do you have an idea, how I can delete all items contained in my black-list? My example black list would be: (ignored-tags '(test1 2del crypt)) My latest approach on a single-item level was: (remove* "test1" alltags :test 'equal :key 'car) >> First, I wanted to get a confirmation that this feature is not >> already part of Org-mode because (as usual) this seemed obvious to >> me when using export functionality ;-) > > It's not clear what you mean by "feature is not already part of Org-mode". Sorry for being unclear. I thought, there might be something like "org-add-inherited-tags" or similar I was not aware of. -- get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: > get Memacs from https://github.com/novoid/Memacs < Personal Information Management > http://Karl-Voit.at/tags/pim/ Emacs-related > http://Karl-Voit.at/tags/emacs/
Re: [O] Make tag inheritance explicit
On Tue, Jan 23, 2018 at 9:45 AM Karl Voitwrote: > > > 2. Use `org-get-tags-at' with point on "Task 1" heading in your example. > > `org-get-tags' returns a list of tags *only* at the current heading. > > `org-get-tags-at' returns inherited tags too. > > You mean for developing a custom-made function that provides the > feature I was asking for? > By "feature", you mean copying all the inherited tags to the heading at point? My suggestion implied that you can skip that copying step altogether and directly use org-get-tags-at to gets all the inherited tags for the current heading. That way, you wouldn't need to add redundant information to your Org file. > Yes, this helps a lot to me. > Great! :) First, I wanted to get a confirmation that this feature is not > already part of Org-mode because (as usual) this seemed obvious to > me when using export functionality ;-) > It's not clear what you mean by "feature is not already part of Org-mode". Org mode provides `org-get-tags-at', which any Org exporter can use. How that function is used is, I think, very subjective. The way I use it in ox-hugo is probably not used in other exporters. -- Kaushal Modi
Re: [O] Make tag inheritance explicit
Hi Carsten, * Carsten Dominikwrote: > > On Tue, Jan 23, 2018 at 11:22 AM, Karl Voit wrote: > >> Background: Org-mode has perfect tag inheritance but unfortunately >> the export methods I am using do export the tags only to the >> headings they are assigned to and not to their sub-headings via >> inheritance. So copying the inherited tags would be a viable >> workaround to me. > > I guess this then should happen optionally during export. Doing this in > the buffer itself makes much less sense. I totally agree. However, from my (non-insider) perspective, this would require all export methods to adapt. Or was this situation improved as we switched the general export framework some time ago? -- get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: > get Memacs from https://github.com/novoid/Memacs < Personal Information Management > http://Karl-Voit.at/tags/pim/ Emacs-related > http://Karl-Voit.at/tags/emacs/
Re: [O] Make tag inheritance explicit
Hi, * Kaushal Modiwrote: > > On Tue, Jan 23, 2018, 5:24 AM Karl Voit wrote: > >> Org-mode has perfect tag inheritance but unfortunately >> the export methods I am using do export the tags only to the >> headings they are assigned to and not to their sub-headings via >> inheritance. > > Hello, > > I am curious how you are exporting. Are you exporting using subtree scope? Always, yes. > I am asking because I am using the exact same style of tagging for my > posts, and I export using subtree scopes using ox-hugo,.. and I faced the > exact same challenge. My current export methods are: HTML, pandoc>docx, latex>PDF > The trick is to: > > 1. Set org-use-tag-inheritance to t (temporarily in let so that it doesn't > populate the user-set global value). Check. > 2. Use `org-get-tags-at' with point on "Task 1" heading in your example. > `org-get-tags' returns a list of tags *only* at the current heading. > `org-get-tags-at' returns inherited tags too. You mean for developing a custom-made function that provides the feature I was asking for? Yes, this helps a lot to me. First, I wanted to get a confirmation that this feature is not already part of Org-mode because (as usual) this seemed obvious to me when using export functionality ;-) -- get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: > get Memacs from https://github.com/novoid/Memacs < Personal Information Management > http://Karl-Voit.at/tags/pim/ Emacs-related > http://Karl-Voit.at/tags/emacs/
Re: [O] Make tag inheritance explicit
On Tue, Jan 23, 2018 at 11:22 AM, Karl Voitwrote: > Hi! > > Is it possible to lookup inherited tags and add them explicitly to > the current heading? > > Example: > > * Project:ProjectX: > ** Sub-Project :@Joe: > *** Task 1 > *** Task 2 > > When I go to "Task 1" (or 2), I want to invoke a command which > "copies" the tags ProjectX and @Joe to the heading of the task. > > > Background: Org-mode has perfect tag inheritance but unfortunately > the export methods I am using do export the tags only to the > headings they are assigned to and not to their sub-headings via > inheritance. So copying the inherited tags would be a viable > workaround to me. > I guess this then should happen optionally during export. Doing this in the buffer itself makes much less sense. Carsten > > Thanks! > > -- > get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: >> get Memacs from https://github.com/novoid/Memacs < > Personal Information Management > http://Karl-Voit.at/tags/pim/ > Emacs-related > http://Karl-Voit.at/tags/emacs/ > > >
Re: [O] Make tag inheritance explicit
On Tue, Jan 23, 2018, 5:24 AM Karl Voitwrote: > Org-mode has perfect tag inheritance but unfortunately > the export methods I am using do export the tags only to the > headings they are assigned to and not to their sub-headings via > inheritance. Hello, I am curious how you are exporting. Are you exporting using subtree scope? I am asking because I am using the exact same style of tagging for my posts, and I export using subtree scopes using ox-hugo,.. and I faced the exact same challenge. The trick is to: 1. Set org-use-tag-inheritance to t (temporarily in let so that it doesn't populate the user-set global value). 2. Use `org-get-tags-at' with point on "Task 1" heading in your example. `org-get-tags' returns a list of tags *only* at the current heading. `org-get-tags-at' returns inherited tags too. Hope this helps. > -- Kaushal Modi