* add additional tag (using %^G) to existing tag in org capture @ 2017-09-07 17:31 Xebar Saram 2017-09-08 5:04 ` Adam Porter 0 siblings, 1 reply; 5+ messages in thread From: Xebar Saram @ 2017-09-07 17:31 UTC (permalink / raw) To: org mode [-- Attachment #1: Type: text/plain, Size: 409 bytes --] Hi! I have this current capture (add-to-list 'org-capture-templates '("bb" "Work.TODO" entry (file+headline (concat pmm "/org/files/agenda/bgu.org") "TDEN") "* TODO %^G %? :@work: \n%^T" )) which seems to work by adding a tag (via the %^G) alongside the current already defined tag in the capture template. is there anyway to add a tag to the current tag in the capture template (:@work: above). Thx! Z [-- Attachment #2: Type: text/html, Size: 611 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add additional tag (using %^G) to existing tag in org capture 2017-09-07 17:31 add additional tag (using %^G) to existing tag in org capture Xebar Saram @ 2017-09-08 5:04 ` Adam Porter 2017-09-08 5:28 ` Xebar Saram 0 siblings, 1 reply; 5+ messages in thread From: Adam Porter @ 2017-09-08 5:04 UTC (permalink / raw) To: emacs-orgmode Xebar Saram <zeltakc@gmail.com> writes: > is there anyway to add a tag to the current tag in the capture template (:@work: above). Hey Z, Sorry, I don't understand the question. Can you clarify what you mean? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add additional tag (using %^G) to existing tag in org capture 2017-09-08 5:04 ` Adam Porter @ 2017-09-08 5:28 ` Xebar Saram 2017-09-08 10:11 ` Adam Porter 0 siblings, 1 reply; 5+ messages in thread From: Xebar Saram @ 2017-09-08 5:28 UTC (permalink / raw) To: Adam Porter; +Cc: org mode [-- Attachment #1: Type: text/plain, Size: 756 bytes --] Hi and thx for the response the issues is that it dosent seem to add an additional tag to the already defined tag list in the capture (:@work: ) but instead add another :TAG: field apart from the already existing tag field. so the final result looks like this: ** TODO TEST :@work: :TAG: while i expect the %^G capture to add to the existing tag entry so it looks like this ** TODO TEST :@work:TAG: thx! Z On Fri, Sep 8, 2017 at 8:04 AM, Adam Porter <adam@alphapapa.net> wrote: > Xebar Saram <zeltakc@gmail.com> writes: > > > is there anyway to add a tag to the current tag in the capture template > (:@work: above). > > Hey Z, > > Sorry, I don't understand the question. Can you clarify what you mean? > > > [-- Attachment #2: Type: text/html, Size: 1817 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add additional tag (using %^G) to existing tag in org capture 2017-09-08 5:28 ` Xebar Saram @ 2017-09-08 10:11 ` Adam Porter 2017-09-10 7:46 ` Nicolas Goaziou 0 siblings, 1 reply; 5+ messages in thread From: Adam Porter @ 2017-09-08 10:11 UTC (permalink / raw) To: emacs-orgmode Xebar Saram <zeltakc@gmail.com> writes: > the issues is that it dosent seem to add an additional tag to the already defined tag list in the capture (:@work: ) but instead add another :TAG: field > apart from the already existing tag field. so the final result looks like this: > > ** TODO TEST :@work: :TAG: > > while i expect the %^G capture to add to the existing tag entry so it looks like this > > ** TODO TEST :@work:TAG: Hey Z, I understand now. Yes, that happens because org-capture-fill-template inserts the tag text manually, like this: #+BEGIN_SRC elisp (let* ((org-last-tags-completion-table (org-global-tags-completion-table (cond ((equal key "G") (org-agenda-files)) (file (list file)) (t nil)))) (org-add-colon-after-tag-completion t) (ins (mapconcat #'identity (org-split-string (completing-read (if prompt (concat prompt ": ") "Tags: ") 'org-tags-completion-function nil nil nil 'org-tags-history) "[^[:alnum:]_@#%]+") ":"))) (when (org-string-nw-p ins) (unless (eq (char-before) ?:) (insert ":")) (insert ins) (unless (eq (char-after) ?:) (insert ":")) (and (org-at-heading-p) (let ((org-ignore-region t)) (org-set-tags nil 'align))))) #+END_SRC It would be simple to have it use org-set-tags-to instead of inserting them manually. I guess that would be correct in the vast majority of cases, however IIUC it would be a change in functionality, as the %^G could be put anywhere in the template and insert tags there (which seems like a strange thing to do, but you never know). On the other hand, it seems like what you're asking for would be the more expected functionality, in which case this would be a bug fix. So maybe the maintainers would accept a patch for that, or maybe not... :) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add additional tag (using %^G) to existing tag in org capture 2017-09-08 10:11 ` Adam Porter @ 2017-09-10 7:46 ` Nicolas Goaziou 0 siblings, 0 replies; 5+ messages in thread From: Nicolas Goaziou @ 2017-09-10 7:46 UTC (permalink / raw) To: Adam Porter; +Cc: emacs-orgmode Hello, Adam Porter <adam@alphapapa.net> writes: > Xebar Saram <zeltakc@gmail.com> writes: > >> the issues is that it dosent seem to add an additional tag to the already defined tag list in the capture (:@work: ) but instead add another :TAG: field >> apart from the already existing tag field. so the final result looks like this: >> >> ** TODO TEST :@work: :TAG: >> >> while i expect the %^G capture to add to the existing tag entry so it looks like this >> >> ** TODO TEST :@work:TAG: > > Hey Z, > > I understand now. Yes, that happens because org-capture-fill-template > inserts the tag text manually, like this: > > #+BEGIN_SRC elisp > (let* ((org-last-tags-completion-table > (org-global-tags-completion-table > (cond ((equal key "G") (org-agenda-files)) > (file (list file)) > (t nil)))) > (org-add-colon-after-tag-completion t) > (ins (mapconcat > #'identity > (org-split-string > (completing-read > (if prompt (concat prompt ": ") "Tags: ") > 'org-tags-completion-function nil nil nil > 'org-tags-history) > "[^[:alnum:]_@#%]+") > ":"))) > (when (org-string-nw-p ins) > (unless (eq (char-before) ?:) (insert ":")) > (insert ins) > (unless (eq (char-after) ?:) (insert ":")) > (and (org-at-heading-p) > (let ((org-ignore-region t)) > (org-set-tags nil 'align))))) > #+END_SRC > > It would be simple to have it use org-set-tags-to instead of inserting > them manually. I guess that would be correct in the vast majority of > cases, however IIUC it would be a change in functionality, as the %^G > could be put anywhere in the template and insert tags there (which seems > like a strange thing to do, but you never know). On the other hand, it > seems like what you're asking for would be the more expected > functionality, in which case this would be a bug fix. So maybe the > maintainers would accept a patch for that, or maybe not... :) Either case sounds odd to me. As you point out, using `org-set-tags-to' means "%^G" is no longer a placeholder, since the change is likely to happen is some other location. From a UI POV, turning "^%G" into a property, e.g., :ask-for-tags, could make more sense. WDYT? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-10 7:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-07 17:31 add additional tag (using %^G) to existing tag in org capture Xebar Saram 2017-09-08 5:04 ` Adam Porter 2017-09-08 5:28 ` Xebar Saram 2017-09-08 10:11 ` Adam Porter 2017-09-10 7:46 ` Nicolas Goaziou
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).