emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Hanno Perrey <hanno@hoowl.se>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] org.el: Improve automatic fast tag selection keys (was: Odd characters in the fast tags selection interface)
Date: Sun, 07 Aug 2022 19:55:55 +0200	[thread overview]
Message-ID: <87a68g7wnb.fsf@hoowl.se> (raw)
In-Reply-To: <871qttn61p.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]



> I am not sure. Omitting (random) part of the tags sounds awkward - some
> tags will be assigned keys and some not. I guess something that will
> improve the current situation would be simply not printing chars beyond
> a-z, while still listing all the tags - it will be less awkward compared
> to current situation when a key is printed but cannot be used anyway.

Good point. I attach a patch that does just that. After the '~'
character, only "space" is assigned -- which feels like a hack, but
means that the selection key field is empty and that the fields are
still aligned nicely. Actually selection any of these items is not
possible as space is assigned to clearing the tags. Should this break
anything that I have missed in my (brief) tests, please let me know!

Additionally, the range A-Z is used once 'z' is reached before assigning
non-alphabetic (but reasonably-reachable) characters. In case that
description is difficult to follow, I attach a screenshot of the
modified code in action.

Please note that I have not (yet) assigned copyright to the FSF.
However, I believe that these changes are still trivial enough to
qualify as TINYCHANGE.

> Or we may provide "paging" approach that will re-assign a-z keys when
> user presses C-n/C-p. Though I do not like this idea too much because we
> have a more universal menu backend in works at
> https://orgmode.org/list/87zgisvuu5.fsf@localhost Adding new feature to
> tag menu does not feel like a good direction to go. If we decide to go
> this way at the end, we may, at least, also need to update
> org-fast-todo-selection along similar lines.

Thanks for pointing out that thread, I missed it earlier. It does sound
like a good idea to wait with more fundamental changes until potential
changes to the backend are settled.

> Finally, we may simply not list tags with keys beyond "z" at all only
> indicating that there are more by showing some text at the end of the
> menu.

That might be an alternative, as I think not even all tags are shown
now. Let me know should you rather go down that route instead.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Improve-automatic-fast-tag-selection-keys.patch --]
[-- Type: text/x-diff, Size: 1285 bytes --]

From cdaa585cea7481aca31148350e77a86f22512d0c Mon Sep 17 00:00:00 2001
From: Hanno Perrey <hanno@hoowl.se>
Date: Sun, 7 Aug 2022 19:44:18 +0200
Subject: [PATCH] org.el: Improve automatic fast tag selection keys

* lisp/org.el (org-fast-tag-selection): After automatically assigning
a-z as keys for selection, offer A-Z range. Continue with characters up
to tilde character before showing only blanks. Replaces previous logic
where also hard-to-type characters were assigned.

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

diff --git a/lisp/org.el b/lisp/org.el
index 8bc123e47..d48a44602 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11762,7 +11762,13 @@ Returns the new tags string, or nil to not change the current settings."
 		  (while (or (rassoc char ntable) (rassoc char table))
 		    (setq char (1+ char)))
 		(setq c2 c1))
-	      (setq c (or c2 char)))
+	      (setq c (or c2
+                          (if (> char ?~)
+                              ?\s
+                            char)))
+              ;; consider characters A-Z after a-z.
+              (if (equal char ?z)
+                  (setq char ?A)))
 	    (when ingroup (push tg (car groups)))
 	    (setq tg (org-add-props tg nil 'face
 				    (cond
-- 
2.34.1


[-- Attachment #3: 20220807_19h13m58s_grim.png --]
[-- Type: image/png, Size: 160839 bytes --]

[-- Attachment #4: Type: text/plain, Size: 34 bytes --]


--
Hanno Perrey
https://hoowl.se

  reply	other threads:[~2022-08-07 18:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 21:41 Odd characters in the fast tags selection interface Hanno
2022-08-05  2:12 ` Ihor Radchenko
2022-08-05 10:54   ` Hanno
2022-08-06  8:13     ` Ihor Radchenko
2022-08-07 17:55       ` Hanno Perrey [this message]
2022-08-07 23:42         ` [PATCH] org.el: Improve automatic fast tag selection keys (was: Odd characters in the fast tags selection interface) Christopher M. Miles
2022-08-08 13:24         ` Ihor Radchenko
     [not found]         ` <62f04f7c.d40a0220.9da67.0a2cSMTPIN_ADDED_BROKEN@mx.google.com>
2022-08-08 13:36           ` [PATCH] org-fast-tag-selection: Make group tags separator not break alignment Ihor Radchenko
2022-08-22 12:02             ` Ihor Radchenko
2022-08-07 23:47       ` Odd characters in the fast tags selection interface Christopher M. Miles

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=87a68g7wnb.fsf@hoowl.se \
    --to=hanno@hoowl.se \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /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).