2

I use the following capture code for making notes.

(setq org-capture-templates '((
     "n"                                         ; key
     "Add a note to abc.org file "               ; description 
     entry                                       ; type
     (file+headline "p.abc.org" "logg")          ; target
     "* %^{Logg}  :NOTE: %(org-set-tags)  \n%?"  ; template
     :prepend t                                  ; properties
     :empty-lines 1                              ; propertiesc
     )))

The template line consists of two sources of tags to the note. (1) I want all notes to be tagged with ":NOTE:", therefor this tag is written directly into the target line. (2) in addition I want to chose tags from my tags list by means of the function org-set-tags.

If I chose the tag :FAMILY: from my tagg list, the note heading end up looking like this:

* Note about something :NOTE: :FAMILY:

In this case only :FAMILY: is behaving as a tag (shown in bold in the headline). How can I change the target line so that the heading line will look like this: ?

* Note about something :NOTE:FAMILY:

where the two tags are collected into the single group :NOTE:FAMILY: and both function as tags?

It does not help to remove the space between :NOTE: and %(org-set-tags) in the target file, because the org-set-tags function insert spaces befor entering the tags you chose from you tags list.

2

org-set-tags won't recognize :NOTE: as a tag, because the heading doesn't exist yet. the following should do it:

(setq org-capture-templates
      `(("n"
         "Add a note to abc.org file "
         entry
         (file+headline "p.abc.org" "logg")
         ,(concat "* %^{Logg} "
                  "%(flet ((org-get-tags-string () \":NOTE:\")) (org-set-tags))"
                  " :NOTE:\n%?")
         :prepend t
         :empty-lines 1
         )))
  • Thanks, very interesting, I will check it out as soon as possible :) – myotis Aug 18 '15 at 12:14
  • Your solution works great, Thanks a lot ! – myotis Aug 18 '15 at 14:16
1

Instead of using %(org-set-tags) in the template, use %^g

  • Hi, unfortunately your solution has exactly the same result as when using %(org-set-tags). The "NOTE" tag is separated from the tags inserted by the %^g` mechanism. If it works on your emacs, but not on my, what could cause such differences? – myotis Aug 18 '15 at 9:50
  • What version of org are you using? – erikstokes Aug 18 '15 at 11:00
  • I have version 8.2.10 – myotis Aug 18 '15 at 11:05
  • It seems to work on 8.3.1 – erikstokes Aug 18 '15 at 11:08
  • is there a simple way of upgrading? – myotis Aug 18 '15 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.