emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] two small fixes for org-fast-tag-selection
@ 2022-02-10 20:21 Alex Giorev
  2022-10-29  5:15 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Giorev @ 2022-02-10 20:21 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 410 bytes --]

- The first patch fixes the problem of TODO keywords and tags sharing keys
when they are automatically generated and when
`org-fast-tag-selection-include-todo' is set.
- The problem solved by the second patch is the following: when invoking
the fast selection interface, and pressing the key of a tag, the tag is
highlighted to indicate it has been selected, but pressing the key again
doesn't unhighlight it.

[-- Attachment #1.2: Type: text/html, Size: 469 bytes --]

[-- Attachment #2: 0002-listp-org.el-unhighlight-org-fast-tag-selection-tag.patch --]
[-- Type: text/x-patch, Size: 1821 bytes --]

From ec433003b77c17ae150c7c399142d9fad6bc5cab Mon Sep 17 00:00:00 2001
From: alexgiorev <alex.giorev@gmail.com>
Date: Thu, 10 Feb 2022 22:14:51 +0200
Subject: [PATCH 2/2] listp/org.el: unhighlight org-fast-tag-selection tag

* lisp/org.el (org-fast-tag-selection): When the key of a tag is
pressed in the fast selection tag interface, the tag is highlighted,
but when it is pressed again it is not unhighlighted. This patch fixes
this issue.

TINYCHANGE
---
 lisp/org.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 6fb79f180..c43ac672d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12408,7 +12408,7 @@ Returns the new tags string, or nil to not change the current settings."
 	 (ncol (/ (- (window-width) 4) fwidth))
 	 (i-face 'org-done)
 	 (c-face 'org-todo)
-	 tg cnt e c char c1 c2 ntable tbl rtn
+	 tg cnt e c char c1 c2 ntable tbl rtn todo-marker
 	 ov-start ov-end ov-prefix
 	 (exit-after-next org-fast-tag-selection-single-key)
 	 (done-keywords org-done-keywords)
@@ -12450,6 +12450,9 @@ Returns the new tags string, or nil to not change the current settings."
 	    (unless (zerop cnt)
 	      (setq cnt 0)
 	      (insert "\n"))
+            (when (eq tbl (cdr todo-table))
+              (setq todo-marker (point-marker))
+              (set-marker-insertion-type todo-marker nil))
 	    (insert (if (cdr e) (format "%s: " (cdr e)) "") "{ "))
 	   ((eq (car e) :endgroup)
 	    (setq ingroup nil cnt 0)
@@ -12505,6 +12508,8 @@ Returns the new tags string, or nil to not change the current settings."
 	      (setq cnt 0)))))
 	(setq ntable (nreverse ntable))
 	(insert "\n")
+        (unless todo-marker
+          (setq todo-marker (point-marker)))
 	(goto-char (point-min))
 	(unless expert (org-fit-window-to-buffer))
 	(setq rtn
-- 
2.25.1


[-- Attachment #3: 0001-lisp-org.el-org-tag-fast-selection-fix-tag-TODO-key-.patch --]
[-- Type: text/x-patch, Size: 1091 bytes --]

From 120c4fd7d9038fdf22dfcfda7f021b0486813464 Mon Sep 17 00:00:00 2001
From: alexgiorev <alex.giorev@gmail.com>
Date: Thu, 10 Feb 2022 17:24:36 +0200
Subject: [PATCH 1/2] lisp/org.el: org-tag-fast-selection fix tag/TODO key
 overlap

* lisp/org.el (org-tag-fast-selection): Avoid key duplication for tags
and TODO keywords when the keys are automatically generated.

TINYCHANGE
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ef8d460e1..6fb79f180 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12480,8 +12480,8 @@ Returns the new tags string, or nil to not change the current settings."
 	      (setq c1 (string-to-char
 			(downcase (substring
 				   tg (if (= (string-to-char tg) ?@) 1 0)))))
-	      (if (or (rassoc c1 ntable) (rassoc c1 table))
-		  (while (or (rassoc char ntable) (rassoc char table))
+	      (if (or (rassoc c1 ntable) (rassoc c1 fulltable))
+		  (while (or (rassoc char ntable) (rassoc char fulltable))
 		    (setq char (1+ char)))
 		(setq c2 c1))
 	      (setq c (or c2 char)))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] two small fixes for org-fast-tag-selection
  2022-02-10 20:21 [PATCH] two small fixes for org-fast-tag-selection Alex Giorev
@ 2022-10-29  5:15 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-10-29  5:15 UTC (permalink / raw)
  To: Alex Giorev; +Cc: emacs-orgmode


Thanks for the patches, and sorry for the late reply.

Alex Giorev <alex.giorev@gmail.com> writes:

> - The first patch fixes the problem of TODO keywords and tags sharing keys
> when they are automatically generated and when
> `org-fast-tag-selection-include-todo' is set.

Could you please show minimal examples that demonstrate the problem you
are trying to fix?

> - The problem solved by the second patch is the following: when invoking
> the fast selection interface, and pressing the key of a tag, the tag is
> highlighted to indicate it has been selected, but pressing the key again
> doesn't unhighlight it.

On my side, the tag does get unenlightened even without the patch (on
the latest main).

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-29  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-10 20:21 [PATCH] two small fixes for org-fast-tag-selection Alex Giorev
2022-10-29  5:15 ` Ihor Radchenko

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).