Hello, I'm playing with an implementation of Zettelkasten using deft and org files, and I want to tag each note with some tags taken from a list (I'm using the ~#FILETAGS:~ line for that at the moment). Is there a builtin org way of doing it (have a list of tags defined somewhere and tag a whole file with them using some completion mechanism, as for headlines), or do I need to roll up my own? Thanks, Alan
Hi Alan,
> I'm playing with an implementation of Zettelkasten using deft and org
> files, and I want to tag each note with some tags taken from a list (I'm
> using the ~#FILETAGS:~ line for that at the moment). Is there a builtin
> org way of doing it (have a list of tags defined somewhere and tag a
> whole file with them using some completion mechanism, as for headlines),
> or do I need to roll up my own?
I'm not entirely sure: you want to tag all headline in a file with
multiple pre-defined tags?
With `org-loop-over-headlines-in-active-region' set to `t', you can
tag multiple headlines by selecting a region with the headlines you
want to tag, then C-c C-q to tag them one after another.
You cannot add multiple tags for each headline this way, though.
I would go for defining a temporary local tag like "replaceme" to
tag multiple (all) headline in the file, then simpy search/replace
occurrences of "replaceme" with your:list:of:tags
HTH,
--
Bastien
Hi Bastien, On 2020-01-26 18:04, Bastien <bzg@gnu.org> writes: > I'm not entirely sure: you want to tag all headline in a file with > multiple pre-defined tags? There are no headlines in the file (it's a small note). I want to tag the file itself (or its content). It's mostly to help with full-text search (I prefix my tags with '#' so they don't occur otherwise). I think the notion of file tag does not really exist in org mode, but as there is a '+#FILETAGS:' cookie (?), I was wondering if there was infrastructure to help me enter the tags there. > With `org-loop-over-headlines-in-active-region' set to `t', you can > tag multiple headlines by selecting a region with the headlines you > want to tag, then C-c C-q to tag them one after another. > > You cannot add multiple tags for each headline this way, though. > > I would go for defining a temporary local tag like "replaceme" to > tag multiple (all) headline in the file, then simpy search/replace > occurrences of "replaceme" with your:list:of:tags Thank you. This is not what I want to do, but it's nice to know how to do this. Alan
Hi Alan,
Alan Schmitt <alan.schmitt@polytechnique.org> writes:
> There are no headlines in the file (it's a small note). I want to tag
> the file itself (or its content). It's mostly to help with full-text
> search (I prefix my tags with '#' so they don't occur otherwise). I
> think the notion of file tag does not really exist in org mode, but as
> there is a '+#FILETAGS:' cookie (?), I was wondering if there was
> infrastructure to help me enter the tags there.
Thanks - I now understand better.
You may want to hack something together based on this:
#+begin_src emacs-lisp
(replace-regexp-in-string "::+" ":" (mapconcat (lambda(s) (if (stringp (car s)) (car s))) org-tag-alist ":"))
#+end_src
--
Bastien