emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Make tag inheritance explicit
@ 2018-01-23 10:22 Karl Voit
  2018-01-23 12:16 ` Kaushal Modi
  2018-01-23 12:17 ` Carsten Dominik
  0 siblings, 2 replies; 7+ messages in thread
From: Karl Voit @ 2018-01-23 10:22 UTC (permalink / raw)
  To: emacs-orgmode

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.

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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 10:22 Make tag inheritance explicit Karl Voit
@ 2018-01-23 12:16 ` Kaushal Modi
  2018-01-23 14:44   ` Karl Voit
  2018-01-23 12:17 ` Carsten Dominik
  1 sibling, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2018-01-23 12:16 UTC (permalink / raw)
  To: Karl Voit; +Cc: emacs-org list

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

On Tue, Jan 23, 2018, 5:24 AM Karl Voit <devnull@karl-voit.at> 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?
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

[-- Attachment #2: Type: text/html, Size: 1554 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 10:22 Make tag inheritance explicit Karl Voit
  2018-01-23 12:16 ` Kaushal Modi
@ 2018-01-23 12:17 ` Carsten Dominik
  2018-01-23 14:55   ` Karl Voit
  1 sibling, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2018-01-23 12:17 UTC (permalink / raw)
  To: Karl Voit; +Cc: org-mode list

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

On Tue, Jan 23, 2018 at 11:22 AM, Karl Voit <devnull@karl-voit.at> wrote:

> 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/
>
>
>

[-- Attachment #2: Type: text/html, Size: 2023 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 12:16 ` Kaushal Modi
@ 2018-01-23 14:44   ` Karl Voit
  2018-01-23 15:15     ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Karl Voit @ 2018-01-23 14:44 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

* Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> On Tue, Jan 23, 2018, 5:24 AM Karl Voit <devnull@karl-voit.at> 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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 12:17 ` Carsten Dominik
@ 2018-01-23 14:55   ` Karl Voit
  0 siblings, 0 replies; 7+ messages in thread
From: Karl Voit @ 2018-01-23 14:55 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten,

* Carsten Dominik <dominik@uva.nl> wrote:
>
> On Tue, Jan 23, 2018 at 11:22 AM, Karl Voit <devnull@karl-voit.at> 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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 14:44   ` Karl Voit
@ 2018-01-23 15:15     ` Kaushal Modi
  2018-01-23 17:33       ` Karl Voit
  0 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2018-01-23 15:15 UTC (permalink / raw)
  To: Karl Voit; +Cc: emacs-orgmode

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

On Tue, Jan 23, 2018 at 9:45 AM Karl Voit <devnull@karl-voit.at> 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?

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

[-- Attachment #2: Type: text/html, Size: 2019 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Make tag inheritance explicit
  2018-01-23 15:15     ` Kaushal Modi
@ 2018-01-23 17:33       ` Karl Voit
  0 siblings, 0 replies; 7+ messages in thread
From: Karl Voit @ 2018-01-23 17:33 UTC (permalink / raw)
  To: emacs-orgmode

* Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> On Tue, Jan 23, 2018 at 9:45 AM Karl Voit <devnull@karl-voit.at> 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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-23 17:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23 10:22 Make tag inheritance explicit Karl Voit
2018-01-23 12:16 ` Kaushal Modi
2018-01-23 14:44   ` Karl Voit
2018-01-23 15:15     ` Kaushal Modi
2018-01-23 17:33       ` Karl Voit
2018-01-23 12:17 ` Carsten Dominik
2018-01-23 14:55   ` Karl Voit

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).