emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Heinrich <com-orgmode-mailinglist@gladbachcity.de>
To: emacs-orgmode@gnu.org
Subject: Re: org-capture and fast selection of tags
Date: Thu, 14 Jul 2022 12:12:20 +0200	[thread overview]
Message-ID: <c146576791b4b39c451d9d6c7a1e120c298f14e7.camel@gladbachcity.de> (raw)
In-Reply-To: <87y1x0que5.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 3311 bytes --]

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 
Christian



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."
                             (org-global-tags-completion-table
                              (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-use-fast-tag-
selection)))
+                  (org-set-tags-command)
+                  (let* (
                            (org-add-colon-after-tag-completion t)
                            (ins (mapconcat
                                  #'identity
@@ -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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-07-14 10:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26  9:32 org-capture and fast selection of tags Christian Heinrich
2022-07-11  2:02 ` Ihor Radchenko
2022-07-14 10:12   ` Christian Heinrich [this message]
2022-07-16  9:12     ` Ihor Radchenko
2022-07-16 15:03       ` Christian Heinrich
2022-07-17 10:14         ` Ihor Radchenko
2022-08-23  2:17           ` Ihor Radchenko
2022-09-28 18:40             ` Christian Heinrich
2022-09-29  3:57               ` Ihor Radchenko
2023-04-02 10:21                 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c146576791b4b39c451d9d6c7a1e120c298f14e7.camel@gladbachcity.de \
    --to=com-orgmode-mailinglist@gladbachcity.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).