From: tumashu <tumashu@163.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re:[PATCH] Add 'simple option to org-fast-tag-selection-single-key.
Date: Thu, 15 Apr 2021 15:56:08 +0800 (CST) [thread overview]
Message-ID: <1195ec1b.430c.178d487bad4.Coremail.tumashu@163.com> (raw)
In-Reply-To: <7f3a03cb.bec.178d321adcb.Coremail.tumashu@163.com>
[-- Attachment #1.1: Type: text/plain, Size: 430 bytes --]
This is v2 patch, use completing-read-multipul.
At 2021-04-15 09:25:03, "tumashu" <tumashu@163.com> wrote:
Hello
I have added 'simple option to org-fast-tag-selection-single-key, please try and comment :-)
(setq org-use-fast-tag-selection t)
(setq org-fast-tag-selection-single-key 'simple)
;; better use vertico or selectrum :-)
;; (require 'vertico)
;; (vertico-mode 1)
thanks!
[-- Attachment #1.2: Type: text/html, Size: 1388 bytes --]
[-- Attachment #2: 0001-Add-simple-option-to-org-fast-tag-selection-single-k.patch --]
[-- Type: application/octet-stream, Size: 5084 bytes --]
From d1438210271ca2e5a06dbfec849d0cc1df639d14 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Thu, 15 Apr 2021 08:59:29 +0800
Subject: [PATCH] Add 'simple option to org-fast-tag-selection-single-key.
* lisp/org.el (org-fast-tag-selection-single-key): Add 'simple option.
(org-fast-tag-selection): Deal with (setq org-fast-tag-selection-single-key 'simple) option.
---
lisp/org.el | 52 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 13 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 675a614e2..ef471776e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2844,12 +2844,15 @@ automatically if necessary."
When nil, you have to press RET to exit it.
During fast tag selection, you can toggle this flag with `C-c'.
This variable can also have the value `expert'. In this case, the window
-displaying the tags menu is not even shown, until you press `C-c' again."
+displaying the tags menu is not even shown, until you press `C-c' again.
+If set this variable to 'simple, the window displaying the tags menu is
+not shown, and edit tab directly (like auto type TAB)."
:group 'org-tags
:type '(choice
(const :tag "No" nil)
(const :tag "Yes" t)
- (const :tag "Expert" expert)))
+ (const :tag "Expert" expert)
+ (const :tag "Simple" simple)))
(defvar org-fast-tag-selection-include-todo nil
"Non-nil means fast tags selection interface will also offer TODO states.
@@ -12159,6 +12162,7 @@ Returns the new tags string, or nil to not change the current settings."
fulltable))))
(buf (current-buffer))
(expert (eq org-fast-tag-selection-single-key 'expert))
+ (simple (eq org-fast-tag-selection-single-key 'simple))
(tab-tags nil)
(fwidth (+ maxlen 3 1 3))
(ncol (/ (- (window-width) 4) fwidth))
@@ -12187,7 +12191,7 @@ Returns the new tags string, or nil to not change the current settings."
(move-overlay org-tags-overlay ov-start ov-end)
(save-excursion
(save-window-excursion
- (if expert
+ (if (or expert simple)
(set-buffer (get-buffer-create " *Org tags*"))
(delete-other-windows)
(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
@@ -12266,10 +12270,12 @@ Returns the new tags string, or nil to not change the current settings."
(setq rtn
(catch 'exit
(while t
- (message "[a-z..]:toggle [SPC]:clear [RET]:accept [TAB]:edit [!] %sgroups%s"
- (if (not groups) "no " "")
- (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
- (setq c (let ((inhibit-quit t)) (read-char-exclusive)))
+ (if simple
+ (setq c ?\t)
+ (message "[a-z..]:toggle [SPC]:clear [RET]:accept [TAB]:edit [!] %sgroups%s"
+ (if (not groups) "no " "")
+ (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
+ (setq c (let ((inhibit-quit t)) (read-char-exclusive))))
(setq org-last-tag-selection-key c)
(cond
((= c ?\r) (throw 'exit t))
@@ -12306,12 +12312,32 @@ Returns the new tags string, or nil to not change the current settings."
(with-current-buffer buf
(org-get-buffer-tags))
table))))))
- (setq tg (completing-read "Tag: " tab-tags))
- (when (string-match "\\S-" tg)
- (cl-pushnew (list tg) tab-tags :test #'equal)
- (if (member tg current)
- (setq current (delete tg current))
- (push tg current)))
+ (let* ((max 5)
+ (n (length current))
+ (prompt
+ (if (> n 0)
+ (format "Tag (%s%s): "
+ (mapconcat #'identity
+ (cl-subseq current 0 (min n max))
+ ", ")
+ (if (> n max)
+ " ..."
+ ""))
+ "Tag: "))
+
+ (tab-tags
+ (mapcar (lambda (x)
+ (if (member (car x) current)
+ (cons (propertize (car x) 'face '(:box t)) (cdr x))
+ x))
+ tab-tags)))
+ (setq tgs (delete-dups (completing-read-multiple prompt tab-tags))))
+ (dolist (tg tgs)
+ (when (string-match "\\S-" tg)
+ (cl-pushnew (list tg) tab-tags :test #'equal)
+ (if (member tg current)
+ (setq current (delete tg current))
+ (push tg current))))
(when exit-after-next (setq exit-after-next 'now)))
((setq e (rassoc c todo-table) tg (car e))
(with-current-buffer buf
--
2.20.1
next prev parent reply other threads:[~2021-04-15 7:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 1:25 [PATCH] Add 'simple option to org-fast-tag-selection-single-key tumashu
2021-04-15 7:56 ` tumashu [this message]
2021-05-01 15:20 ` Bastien
2021-05-08 9:50 ` tumashu
2021-05-08 10:00 ` tumashu
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=1195ec1b.430c.178d487bad4.Coremail.tumashu@163.com \
--to=tumashu@163.com \
--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).