emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alex Giorev <alex.giorev@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] two small fixes for org-fast-tag-selection
Date: Thu, 10 Feb 2022 22:21:36 +0200	[thread overview]
Message-ID: <CAMq3WZg4UUXruHVbv56bEAcGAbbvcAbAznQrBx_RbzetUZysSA@mail.gmail.com> (raw)


[-- 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


             reply	other threads:[~2022-02-10 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 20:21 Alex Giorev [this message]
2022-10-29  5:15 ` [PATCH] two small fixes for org-fast-tag-selection 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=CAMq3WZg4UUXruHVbv56bEAcGAbbvcAbAznQrBx_RbzetUZysSA@mail.gmail.com \
    --to=alex.giorev@gmail.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).