[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-capture and fast selection of tags

From: Christian Heinrich
Subject: Re: org-capture and fast selection of tags
Date: Thu, 14 Jul 2022 12:12:20 +0200
User-agent: Evolution 3.44.2-1

Hi Ihor,

thanks for your reply.

I looked at the code and came up with a patch that works for me (see below). 
However, this may
change behavior for others:

1. The original %^g will work on non-headlines, but if (org-set-tags-command) 
is called as I do,
this is no longer possible and would need to be checked (what would be a good 
way here?)

2. Can I really deduce from (org-use-fast-tag-selection) being non-nil that 
fast selection should be
used in capture templates as well? Does it actually make sense to incorporate 
this into %^g/G?

I am neither a lisp programmer nor acquainted with the org codebase; this is a 
draft I came up
with. If you can provide me with further feedback, I'm willing to make this 
more stable.

Best regards 

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9ef160d16..a2a05c69d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -72,6 +72,7 @@
 (defvar crm-separator)
 (defvar org-end-time-was-given)
 (defvar org-keyword-properties)
+(defvar org-use-fast-tag-selection)
 (defvar org-remember-default-headline)
 (defvar org-remember-templates)
 (defvar org-store-link-plist)
@@ -1751,7 +1752,10 @@ Expansion occurs in a temporary Org mode buffer."
                              (cond ((equal key "G") (org-agenda-files))
                                    (file (list file))
-                                   (t nil))))
+                                   (t nil)))))
+                (if (and (boundp 'org-use-fast-tag-selection) (not (null 
+                  (org-set-tags-command)
+                  (let* (
                            (org-add-colon-after-tag-completion t)
                            (ins (mapconcat
@@ -1765,7 +1769,7 @@ Expansion occurs in a temporary Org mode buffer."
                         (unless (eq (char-before) ?:) (insert ":"))
                         (insert ins)
                         (unless (eq (char-after) ?:) (insert ":"))
-                        (when (org-at-heading-p) (org-align-tags)))))
+                        (when (org-at-heading-p) (org-align-tags)))))))
                    ((or "C" "L")
                     (let ((insert-fun (if (equal key "C") #'insert
                                         (lambda (s) (org-insert-link 0 s)))))

On Mon, 2022-07-11 at 10:02 +0800, Ihor Radchenko wrote:
> Christian Heinrich <christian@gladbachcity.de> writes:
> > Today, I went through your init.org on github (it's ... huge) and couldn't 
> > find anything there
> > either.
> That's because I rarely need to set standard tags when capturing staff.
> So, I am content with entering tags manually.
> > ... Do you have an idea
> > on how to use fast selection of tags (using shortcuts) when capturing an 
> > entry?
> > ...
> > I first thought that using %(org-set-tags-command) should work; but the 
> > capture-buffer is
> > narrowed
> > (i.e., no tags are available),...
> %(org-with-wide-buffer (org-set-tags-command)) may work.
> Of course, we may also implement a proper capture selection for %^g
> template. As usual, patches are welcome.
> Best,
> Ihor

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]