* [PATCH] Add 'simple option to org-fast-tag-selection-single-key.
@ 2021-04-15 1:25 tumashu
2021-04-15 7:56 ` tumashu
0 siblings, 1 reply; 5+ messages in thread
From: tumashu @ 2021-04-15 1:25 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 303 bytes --]
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: 790 bytes --]
[-- Attachment #2: 0001-Add-simple-option-to-org-fast-tag-selection-single-k.patch --]
[-- Type: application/octet-stream, Size: 4799 bytes --]
From 8d87a5e464d4089fc66bb520d3a43c950abea38c 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 | 45 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 9 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 675a614e2..d60d8ce57 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,8 +12312,29 @@ 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)
+ (let* ((max 5)
+ (n (length current))
+ (prompt
+ (if (and simple (> n 0))
+ (format "Tag (%s%s): "
+ (mapconcat #'identity
+ (cl-subseq current 0 (min n max))
+ ", ")
+ (if (> n max)
+ " ..."
+ ""))
+ "Tag: "))
+
+ (tab-tags
+ (if simple
+ (mapcar (lambda (x)
+ (if (member (car x) current)
+ (cons (propertize (car x) 'face '(:box t)) (cdr x))
+ x))
+ tab-tags)
+ tab-tags)))
+ (setq tg (completing-read prompt tab-tags)))
+ (when (string-match "\\S-" tg)
(cl-pushnew (list tg) tab-tags :test #'equal)
(if (member tg current)
(setq current (delete tg current))
--
2.20.1
[-- Attachment #3: 截图_2021-04-15_09-20-36.png --]
[-- Type: image/png, Size: 25738 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re:[PATCH] Add 'simple option to org-fast-tag-selection-single-key.
2021-04-15 1:25 [PATCH] Add 'simple option to org-fast-tag-selection-single-key tumashu
@ 2021-04-15 7:56 ` tumashu
2021-05-01 15:20 ` [PATCH] " Bastien
0 siblings, 1 reply; 5+ messages in thread
From: tumashu @ 2021-04-15 7:56 UTC (permalink / raw)
To: emacs-orgmode
[-- 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Add 'simple option to org-fast-tag-selection-single-key.
2021-04-15 7:56 ` tumashu
@ 2021-05-01 15:20 ` Bastien
2021-05-08 9:50 ` tumashu
0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-01 15:20 UTC (permalink / raw)
To: tumashu; +Cc: emacs-orgmode
Hi tumashu,
tumashu <tumashu@163.com> writes:
> This is v2 patch, use completing-read-multipul.
Thanks for the patch. You can already do this:
(setq org-use-fast-tag-selection nil)
Then you'll be able to select tags the way you implemented it
with this simple mode.
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] Add 'simple option to org-fast-tag-selection-single-key.
2021-05-01 15:20 ` [PATCH] " Bastien
@ 2021-05-08 9:50 ` tumashu
2021-05-08 10:00 ` tumashu
0 siblings, 1 reply; 5+ messages in thread
From: tumashu @ 2021-05-08 9:50 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
At 2021-05-01 23:20:24, "Bastien" <bzg@gnu.org> wrote:
>Hi tumashu,
>
>tumashu <tumashu@163.com> writes:
>
>> This is v2 patch, use completing-read-multipul.
>
>Thanks for the patch. You can already do this:
>
>(setq org-use-fast-tag-selection nil)
>
>Then you'll be able to select tags the way you implemented it
>with this simple mode.
I think (setq org-use-fast-tag-selection nil) do not work well with ivy, selectrum or vertico.
I like the below idea, but seem to no progress.
https://lists.gnu.org/archive/html/emacs-orgmode/2020-07/msg00222.html
>
>--
> Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re:Re: [PATCH] Add 'simple option to org-fast-tag-selection-single-key.
2021-05-08 9:50 ` tumashu
@ 2021-05-08 10:00 ` tumashu
0 siblings, 0 replies; 5+ messages in thread
From: tumashu @ 2021-05-08 10:00 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
>I think (setq org-use-fast-tag-selection nil) do not work well with ivy, selectrum or vertico.
>
>I like the below idea, but seem to no progress.
> https://lists.gnu.org/archive/html/emacs-orgmode/2020-07/msg00222.html
If this patch is hard to merge, I think my patch is a conside way, for it nearly doesn't affect other places
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-08 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-15 1:25 [PATCH] Add 'simple option to org-fast-tag-selection-single-key tumashu
2021-04-15 7:56 ` tumashu
2021-05-01 15:20 ` [PATCH] " Bastien
2021-05-08 9:50 ` tumashu
2021-05-08 10:00 ` tumashu
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).