On 2026-02-22 08:12, Ihor Radchenko wrote:
> "Jacob S. Gordon" <[email protected]> writes:
>> --8<--
>> I’ll hold off on attaching v2 in case you want to adjust this.
>
> I agree.
Please find v2 attached. While testing I also fixed an error in the
global context menu when ‘org-agenda’ isn’t loaded. I split the fixes
so that the commits are atomic, and for ease of reviewing, but they
could probably be squashed.
Thanks,
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 6cb478319714c7ba7bbc580add7901452bb7a07b Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:20:00 -0500
Subject: [PATCH v2 1/9] org-mouse: Account for numeric priorities
* lisp/org-mouse.el (org-mouse-priority-regexp): Construct with
'org-priority-value-regexp' and amend doc string.
(org-mouse-get-priority): Use 'org-priority-to-string' and correct doc
string.
(org-mouse-priority-list): Start from 'org-priority-highest', use
'org-priority-to-string', and add doc string.
(org-mouse-context-menu): Adjust condition for the local context menu,
and use 'org-priority-to-value' in the global context menu.
---
lisp/org-mouse.el | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index cf303ee96..d34b5fd2b 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -377,18 +377,21 @@ (defun org-mouse-set-priority (priority)
"Set the priority of the current headline to PRIORITY."
(org-priority priority))
-(defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]"
+(defvar org-mouse-priority-regexp
+ (format "\\[#\\(%s\\)\\]" org-priority-value-regexp)
"Regular expression matching the priority indicator.
Differs from `org-priority-regexp' in that it doesn't contain the
-leading `.*?'.")
+leading `.*?' and only matches a group for the priority value.")
(defun org-mouse-get-priority (&optional default)
"Return the priority of the current headline.
-DEFAULT is returned if no priority is given in the headline."
+If the headline does not contain a priority, return `org-priority-default'
+when DEFAULT is non-nil and nil otherwise."
(save-excursion
(if (org-mouse-re-search-line org-mouse-priority-regexp)
(match-string 1)
- (when default (char-to-string org-priority-default)))))
+ (when default
+ (org-priority-to-string org-priority-default)))))
(defun org-mouse-delete-timestamp ()
"Deletes the current timestamp as well as the preceding keyword.
@@ -409,8 +412,9 @@ (defun org-mouse-looking-at (regexp skipchars &optional movechars)
(> (match-end 0) point))))))
(defun org-mouse-priority-list ()
- (cl-loop for priority from ?A to org-priority-lowest
- collect (char-to-string priority)))
+ "Priorities from `org-priority-highest' to `org-priority-lowest' as strings."
+ (cl-loop for priority from org-priority-highest to org-priority-lowest
+ collect (org-priority-to-string priority)))
(defun org-mouse-todo-menu (state)
"Create the menu with TODO keywords."
@@ -684,7 +688,7 @@ (defun org-mouse-context-menu (&optional event)
"--"
["Check Deadlines" org-check-deadlines t]
)))
- ((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z#") ; priority
+ ((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z0-9#") ; priority
(popup-menu `(nil ,@(org-mouse-keyword-replace-menu
(org-mouse-priority-list) 1 "Priority %s" t))))
((funcall get-context :link)
@@ -803,7 +807,7 @@ (defun org-mouse-context-menu (&optional event)
,@(org-mouse-keyword-menu
(org-mouse-priority-list)
(lambda (keyword)
- (org-mouse-set-priority (string-to-char keyword)))
+ (org-mouse-set-priority (org-priority-to-value keyword)))
priority "Priority %s")
"--"
,@(org-mouse-tag-menu))
base-commit: 8e2c28d1b1567b01c44754a623bac9fe6edc05fd
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From a69e7c599a18565cab8ddba338ddd54e9b621a7f Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:21:00 -0500
Subject: [PATCH v2 2/9] ; org-mouse: Refactor priority menus
* lisp/org-mouse.el (org-mouse-priority-menu): Refactor priority
menus into a common function.
(org-mouse-context-menu): Use function in the local and global context
menus.
---
lisp/org-mouse.el | 103 ++++++++++++++++++++++++----------------------
1 file changed, 54 insertions(+), 49 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index d34b5fd2b..b6eaa805f 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -416,6 +416,17 @@ (defun org-mouse-priority-list ()
(cl-loop for priority from org-priority-highest to org-priority-lowest
collect (org-priority-to-string priority)))
+(defun org-mouse-priority-menu ()
+ "Create the priority menu."
+ (append (org-mouse-keyword-menu
+ (org-mouse-priority-list)
+ (lambda (keyword) (org-mouse-set-priority
+ (org-priority-to-value keyword)))
+ (org-mouse-get-priority t)
+ "Priority %s")
+ '("--"
+ ["None" (org-priority 'remove) t])))
+
(defun org-mouse-todo-menu (state)
"Create the menu with TODO keywords."
(append
@@ -689,8 +700,7 @@ (defun org-mouse-context-menu (&optional event)
["Check Deadlines" org-check-deadlines t]
)))
((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z0-9#") ; priority
- (popup-menu `(nil ,@(org-mouse-keyword-replace-menu
- (org-mouse-priority-list) 1 "Priority %s" t))))
+ (popup-menu `(nil ,@(org-mouse-priority-menu))))
((funcall get-context :link)
(popup-menu
'(nil
@@ -800,54 +810,49 @@ (defun org-mouse-context-menu (&optional event)
:style toggle :selected org-table-formula-debug]
)))
((and (assq :headline contextlist) (not (eolp)))
- (let ((priority (org-mouse-get-priority t)))
- (popup-menu
- `("Headline Menu"
- ("Tags and Priorities"
- ,@(org-mouse-keyword-menu
- (org-mouse-priority-list)
- (lambda (keyword)
- (org-mouse-set-priority (org-priority-to-value keyword)))
- priority "Priority %s")
- "--"
- ,@(org-mouse-tag-menu))
- ("TODO Status"
- ,@(org-mouse-todo-menu (org-get-todo-state)))
- ["Show Tags"
- (with-current-buffer org-mouse-main-buffer (org-agenda-show-tags))
- :visible (not org-mouse-direct)]
- ["Show Priority"
- (with-current-buffer org-mouse-main-buffer (org-agenda-show-priority))
- :visible (not org-mouse-direct)]
- ,@(if org-mouse-direct '("--") nil)
- ["New Heading" org-mouse-insert-heading :visible org-mouse-direct]
- ["Set Deadline"
- (progn (org-mouse-end-headline) (insert " ") (org-deadline))
- :active (not (save-excursion
- (org-mouse-re-search-line org-deadline-regexp)))]
- ["Schedule Task"
- (progn (org-mouse-end-headline) (insert " ") (org-schedule))
- :active (not (save-excursion
- (org-mouse-re-search-line org-scheduled-regexp)))]
- ["Insert Timestamp"
- (progn (org-mouse-end-headline) (insert " ") (org-timestamp nil)) t]
+ (popup-menu
+ `("Headline Menu"
+ ("Tags and Priorities"
+ ,@(org-mouse-priority-menu)
+ "--"
+ ,@(org-mouse-tag-menu))
+ ("TODO Status"
+ ,@(org-mouse-todo-menu (org-get-todo-state)))
+ ["Show Tags"
+ (with-current-buffer org-mouse-main-buffer (org-agenda-show-tags))
+ :visible (not org-mouse-direct)]
+ ["Show Priority"
+ (with-current-buffer org-mouse-main-buffer (org-agenda-show-priority))
+ :visible (not org-mouse-direct)]
+ ,@(if org-mouse-direct '("--") nil)
+ ["New Heading" org-mouse-insert-heading :visible org-mouse-direct]
+ ["Set Deadline"
+ (progn (org-mouse-end-headline) (insert " ") (org-deadline))
+ :active (not (save-excursion
+ (org-mouse-re-search-line org-deadline-regexp)))]
+ ["Schedule Task"
+ (progn (org-mouse-end-headline) (insert " ") (org-schedule))
+ :active (not (save-excursion
+ (org-mouse-re-search-line org-scheduled-regexp)))]
+ ["Insert Timestamp"
+ (progn (org-mouse-end-headline) (insert " ") (org-timestamp nil)) t]
; ["Timestamp (inactive)" org-timestamp-inactive t]
- "--"
- ["Archive Subtree" org-archive-subtree]
- ["Cut Subtree" org-cut-special]
- ["Copy Subtree" org-copy-special]
- ["Paste Subtree" org-paste-special :visible org-mouse-direct]
- ("Sort Children"
- ["Alphabetically" (org-sort-entries nil ?a)]
- ["Numerically" (org-sort-entries nil ?n)]
- ["By Time/Date" (org-sort-entries nil ?t)]
- "--"
- ["Reverse Alphabetically" (org-sort-entries nil ?A)]
- ["Reverse Numerically" (org-sort-entries nil ?N)]
- ["Reverse By Time/Date" (org-sort-entries nil ?T)])
- "--"
- ["Move Trees" org-mouse-move-tree :active nil]
- ))))
+ "--"
+ ["Archive Subtree" org-archive-subtree]
+ ["Cut Subtree" org-cut-special]
+ ["Copy Subtree" org-copy-special]
+ ["Paste Subtree" org-paste-special :visible org-mouse-direct]
+ ("Sort Children"
+ ["Alphabetically" (org-sort-entries nil ?a)]
+ ["Numerically" (org-sort-entries nil ?n)]
+ ["By Time/Date" (org-sort-entries nil ?t)]
+ "--"
+ ["Reverse Alphabetically" (org-sort-entries nil ?A)]
+ ["Reverse Numerically" (org-sort-entries nil ?N)]
+ ["Reverse By Time/Date" (org-sort-entries nil ?T)])
+ "--"
+ ["Move Trees" org-mouse-move-tree :active nil]
+ )))
(t
(org-mouse-popup-global-menu)))))
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 4f73af432bf41cf3286be791c8f92c7239f987ba Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:22:00 -0500
Subject: [PATCH v2 3/9] org-mouse: Separate tag and priority menus
* etc/ORG-NEWS (Important announcements and breaking changes):
Announce change.
* lisp/org-mouse.el (org-mouse-context-menu): Separate tag and
priority sections in the global context menu.
---
etc/ORG-NEWS | 5 +++++
lisp/org-mouse.el | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b125558b0..fccd5c878 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -25,6 +25,11 @@ Please send Org bug reports to mailto:[email protected].
# require user action for most Org mode users.
# Sorted from most important to least important.
+*** ~org-mouse~ tag and priority menus are now separate
+
+The "Tags and Priorities" section of the global context menu is split
+into a "Tags" section and a "Priorities" section.
+
** New features
# We list the most important features, and the features that may
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index b6eaa805f..68ebc3e55 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -812,10 +812,8 @@ (defun org-mouse-context-menu (&optional event)
((and (assq :headline contextlist) (not (eolp)))
(popup-menu
`("Headline Menu"
- ("Tags and Priorities"
- ,@(org-mouse-priority-menu)
- "--"
- ,@(org-mouse-tag-menu))
+ ("Priorities" ,@(org-mouse-priority-menu))
+ ("Tags" ,@(org-mouse-tag-menu))
("TODO Status"
,@(org-mouse-todo-menu (org-get-todo-state)))
["Show Tags"
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 46acd74f62ca283ca5cf51555be2dfa816a58434 Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:23:00 -0500
Subject: [PATCH v2 4/9] org-mouse: Add actions to priority menus
* etc/ORG-NEWS (New features): Announce change.
* lisp/org-mouse.el (org-mouse-priority-menu): Add actions.
---
etc/ORG-NEWS | 5 +++++
lisp/org-mouse.el | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index fccd5c878..472f7ef76 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -35,6 +35,11 @@ into a "Tags" section and a "Priorities" section.
# We list the most important features, and the features that may
# require user action to be used.
+*** New actions in the ~org-mouse~ priority menus
+
+Priorities can now be increased, decreased, set to the default, and
+set interactively from the priority context menus.
+
** New and changed options
# Changes dealing with changing default values of customizations,
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 68ebc3e55..594e08e59 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -425,7 +425,11 @@ (defun org-mouse-priority-menu ()
(org-mouse-get-priority t)
"Priority %s")
'("--"
- ["None" (org-priority 'remove) t])))
+ ["None" (org-priority 'remove) t]
+ ["Increase" (org-priority-up) t]
+ ["Decrease" (org-priority-down) t]
+ ["Default" (org-priority org-priority-default) t]
+ ["Set..." (org-priority 'set) t])))
(defun org-mouse-todo-menu (state)
"Create the menu with TODO keywords."
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 70bc56498f08d121f31d916cdd194eb258aed21e Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:24:00 -0500
Subject: [PATCH v2 5/9] ; org-mouse: Fix schedule and deadline actions
* lisp/org-mouse.el (org-mouse-context-menu): Call 'org-deadline' and
'org-schedule' interactively.
---
lisp/org-mouse.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 594e08e59..b2a6377ad 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -829,11 +829,11 @@ (defun org-mouse-context-menu (&optional event)
,@(if org-mouse-direct '("--") nil)
["New Heading" org-mouse-insert-heading :visible org-mouse-direct]
["Set Deadline"
- (progn (org-mouse-end-headline) (insert " ") (org-deadline))
+ (call-interactively #'org-deadline)
:active (not (save-excursion
(org-mouse-re-search-line org-deadline-regexp)))]
["Schedule Task"
- (progn (org-mouse-end-headline) (insert " ") (org-schedule))
+ (call-interactively #'org-schedule)
:active (not (save-excursion
(org-mouse-re-search-line org-scheduled-regexp)))]
["Insert Timestamp"
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 8d88f63bbccd8d8a38373b22db639a883d71803f Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:25:00 -0500
Subject: [PATCH v2 6/9] ; org-mouse: Fix error when org-agenda is not loaded
* lisp/org-mouse.el (org-mouse-popup-global-menu): Ensure 'org-agenda'
is loaded to avoid an unbound 'org-agenda-custom-commands'.
---
lisp/org-mouse.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index b2a6377ad..cc258aefc 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -506,6 +506,7 @@ (defun org-mouse-clip-text (text maxlength)
text))
(defun org-mouse-popup-global-menu ()
+ (unless (featurep 'org-agenda) (require 'org-agenda))
(popup-menu
`("Main Menu"
["Show Overview" org-mouse-show-overview t]
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From ae4813f2ae3c2ca2a3fe225d3cf80662074e0b23 Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:26:00 -0500
Subject: [PATCH v2 7/9] ; org-mouse: Fix custom agenda entry actions
* lisp/org-mouse.el (org-mouse-popup-global-menu): Pass agenda keys as
strings.
---
lisp/org-mouse.el | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index cc258aefc..f9b315ae2 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -543,8 +543,7 @@ (defun org-mouse-popup-global-menu ()
"--"
,@(org-mouse-keyword-menu
(mapcar #'car org-agenda-custom-commands)
- (lambda (key)
- (org-agenda nil (string-to-char key)))
+ (lambda (key) (org-agenda nil key))
nil
(lambda (key)
(let ((entry (assoc key org-agenda-custom-commands)))
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From da3362cb85275ddcdbb036d60e6814ceecde6c0c Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:27:00 -0500
Subject: [PATCH v2 8/9] ; org-mouse: Fix errors when called from the agenda
* lisp/org-mouse.el (org-mouse-cmd): Remove unbound variable.
(org-mouse-do-remotely): Remove messages.
---
lisp/org-mouse.el | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index f9b315ae2..89432c7f7 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -1006,8 +1006,6 @@ (defun org-mouse-transform-to-outline ()
(replace-match replace-text))
(forward-line))))
-(defvar org-mouse-cmd) ;dynamically scoped from `org-with-remote-undo'.
-
(defun org-mouse-do-remotely (command)
;; (org-agenda-check-no-diary)
(when (get-text-property (point) 'org-marker)
@@ -1037,11 +1035,8 @@ (defun org-mouse-do-remotely (command)
(setq marker (point-marker))
(goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
(funcall command)
- (message "_cmd: %S" org-mouse-cmd)
- (message "this-command: %S" this-command)
(unless (eq (marker-position marker) (marker-position endmarker))
(setq newhead (org-get-heading))))
-
(forward-line 1)
(save-excursion
(org-agenda-change-all-lines newhead hdmarker 'fixface))))
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 09b673cf7b2df6b6313ac2691651500bed6bcb2d Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Mon, 23 Feb 2026 16:28:00 -0500
Subject: [PATCH v2 9/9] ; org-mouse: Fix action to show priority in the agenda
* lisp/org-mouse.el (org-mouse-context-menu): Use 'org-priority-show'
and mention that the priority is weighted in the menu text.
---
lisp/org-mouse.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 89432c7f7..1487c8ed9 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -823,8 +823,8 @@ (defun org-mouse-context-menu (&optional event)
["Show Tags"
(with-current-buffer org-mouse-main-buffer (org-agenda-show-tags))
:visible (not org-mouse-direct)]
- ["Show Priority"
- (with-current-buffer org-mouse-main-buffer (org-agenda-show-priority))
+ ["Show Weighted Priority"
+ (with-current-buffer org-mouse-main-buffer (org-priority-show))
:visible (not org-mouse-direct)]
,@(if org-mouse-direct '("--") nil)
["New Heading" org-mouse-insert-heading :visible org-mouse-direct]
--
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument