[PATCH] two small fixes for org-fast-tag-selection
- 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. From ec433003b77c17ae150c7c399142d9fad6bc5cab Mon Sep 17 00:00:00 2001 From: alexgiorev 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 From 120c4fd7d9038fdf22dfcfda7f021b0486813464 Mon Sep 17 00:00:00 2001 From: alexgiorev 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
[PATCH] Fix org-set-tags-command active region bug
When `org-loop-over-headlines-in-active-region' is 'start-level, the command should loop only over the headings having the same level as the first one, but it loops over all headings in the region. This patch fixes the issue. From 289d6bdcb8328554c6dd4136d38f1220d239940e Mon Sep 17 00:00:00 2001 From: alexgiorev Date: Wed, 9 Feb 2022 16:22:09 +0200 Subject: [PATCH] lisp/org.el: Fix org-set-tags-command active region bug * lisp/org.el (org-set-tags-command): When called with an active region and `org-loop-over-headlines-in-active-region` having a value `start-level', it is supposed to loop only over the headings at the same level as the first one, but without this fix it loops over all headings in the region. --- lisp/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ef8d460e1..b2091a4fe 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12183,11 +12183,12 @@ in Lisp code use `org-set-tags' instead." (cond ((equal '(4) arg) (org-align-tags t)) ((and (org-region-active-p) org-loop-over-headlines-in-active-region) - (let (org-loop-over-headlines-in-active-region) ; hint: infinite recursion. + (let ((original org-loop-over-headlines-in-active-region) +(org-loop-over-headlines-in-active-region nil)) ; hint: infinite recursion. (org-map-entries #'org-set-tags-command nil - (if (eq org-loop-over-headlines-in-active-region 'start-level) + (if (eq original 'start-level) 'region-start-level 'region) (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)) -- 2.25.1
A couple of `org-priority' fixes
I found a couple of problems in org-priority, I think these patches fix them. - The first patch is truly minor, it just adds a bit to the docstring - The problem which prompted the second patch arises when all priorities are lowercase (you can test this by evaluating (setq org-priority-highest ?a org-priority-lowest ?z org-priority-default ?o) and then trying to set the priority to some lowercase letter) - The problem solved by the third patch arises when numerical priorities are used and 32 is given as the argument, 32 being the character code of the space character, because that character is used to signal property removal. From 4f2b192743e4f8056a1e6682dbffa3d236700b46 Mon Sep 17 00:00:00 2001 From: alexgiorev Date: Sat, 5 Feb 2022 00:33:54 +0200 Subject: [PATCH 1/3] lisp/org.el: Add `remove' action in org-priority docstring * lisp/org.el (org-priority): Add `remove' action in org-priority docstring TINYCHANGE --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index ef8d460e1..2543498de 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11346,7 +11346,7 @@ When called interactively with a `\\[universal-argument]' prefix, show the priority in the minibuffer instead of changing it. When called programmatically, ACTION can be `set', `up', `down', -or a character." +`remove', or a character." (interactive "P") (when show ;; Deprecation warning inserted for Org 9.2; once enough time has -- 2.25.1 From 524ee9c37c99019b6e700c98919ebb1bd8fd57c7 Mon Sep 17 00:00:00 2001 From: alexgiorev Date: Sat, 5 Feb 2022 00:43:40 +0200 Subject: [PATCH 2/3] lisp/org.el: Remove (upcase new) in `org-priority' * lisp/org.el (org-priority): After the new priority is computed, when checking if it is within the bounds defined by `org-priority-highest' and `org-priority-lowest', the priority is upcased, but this leads to an error when all priorities are lowercase letters. TINYCHANGE --- lisp/org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 2543498de..757c306bc 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11391,7 +11391,7 @@ When called programmatically, ACTION can be `set', `up', `down', (= (upcase org-priority-lowest) org-priority-lowest)) (setq new (upcase new))) (cond ((equal new ?\s) (setq remove t)) - ((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest)) + ((or (< new org-priority-highest) (> new org-priority-lowest)) (user-error (if nump "Priority must be between `%s' and `%s'" @@ -11418,8 +11418,8 @@ When called programmatically, ACTION can be `set', `up', `down', org-priority-default (1+ org-priority-default)) (t (user-error "Invalid action"))) - (when (or (< (upcase new) org-priority-highest) - (> (upcase new) org-priority-lowest)) + (when (or (< new org-priority-highest) + (> new org-priority-lowest)) (if (and (memq action '(up down)) (not have) (not (eq last-command this-command))) ;; `new' is from default priority -- 2.25.1 From 5aea96e258b694d25aa9ebc0012f499d09b415b6 Mon Sep 17 00:00:00 2001 From: alexgiorev Date: Sat, 5 Feb 2022 00:50:26 +0200 Subject: [PATCH 3/3] lisp/org.el: Fix priority 32 removing the cookie in org-priority * lisp/org.el (org-priority): When numerical priorities are used, and the caller supplies 32 as the new priority value, the priority cookie is removed because this is the code point of the space character. This patch fixes this so that supplying 32 will change the priority to 32. TINYCHANGE --- lisp/org.el | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 757c306bc..3ffddff94 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11382,21 +11382,23 @@ When called programmatically, ACTION can be `set', `up', `down', (read-string msg) (message msg) (char-to-string (read-char-exclusive) - (if (equal s " ") ?\s (string-to-number s))) + (if (equal s " ") + (progn (setq remove t) ?\s) + (string-to-number s))) (progn (message "Priority %c-%c, SPC to remove: " org-priority-highest org-priority-lowest) (save-match-data - (setq new (read-char-exclusive))) + (setq new (read-char-exclusive) + remove (= new ?\s))) (when (and (= (upcase org-priority-highest) org-priority-highest) (= (upcase org-priority-lowest) org-priority-lowest)) (setq new (upcase new))) - (cond ((equal new ?\s) (setq remove t)) - ((or (< new org-priority-highest) (> new org-priority-lowest)) - (user-error - (if nump - "Priority must be between `%s' and `%s'" - "Priority must be between `%c' and `%c'") - org-priority-highest