From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: add additional tag (using %^G) to existing tag in org capture Date: Fri, 08 Sep 2017 05:11:15 -0500 Message-ID: <87wp59biv0.fsf@alphapapa.net> References: <87377xdbni.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqGGX-00062y-DB for emacs-orgmode@gnu.org; Fri, 08 Sep 2017 06:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqGGS-0000YM-PV for emacs-orgmode@gnu.org; Fri, 08 Sep 2017 06:12:01 -0400 Received: from [195.159.176.226] (port=59171 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqGGS-0000XO-J7 for emacs-orgmode@gnu.org; Fri, 08 Sep 2017 06:11:56 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dqGFy-0002wf-2m for emacs-orgmode@gnu.org; Fri, 08 Sep 2017 12:11:26 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Xebar Saram 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... :)