emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marcel Lauhoff <ml@irq0.org>
To: emacs-orgmode@gnu.org
Subject: Unicode TODO keyword issues in agenda search leading to org-scan-tags regex
Date: Thu, 1 Sep 2022 10:17:13 +0200	[thread overview]
Message-ID: <C5370FC1-ABBB-4FA1-8364-5B1DF0FB4755@irq0.org> (raw)

Hello!

I use unicode characters as TODO keywords and noticed that the "M"
agenda view doesn't find all my TODO entries.

My TODO keywords:
┌────
│ org-todo-keywords '((sequence "≣(p)" "|" "∎(f)")
│ 		    (sequence "◇(t)" "★" "⌛(w)" "🔥(.)" "⚙(s)" "⎇(r)" "⏵(e)" "|" "✔(d)" "✘(c)")
│ 		    (sequence "⛱(m)" "|"))
│ 
└────

Digging a bit I found that the `re' regex at be beginning of
`org-scan-tags' is responsible:

┌────
│ (re (concat "^"
│ 		     (if start-level
│ 			 ;; Get the correct level to match
│ 			 (concat "\\*\\{" (number-to-string start-level) "\\} ")
│ 		       org-outline-regexp)
│ 		     " *\\(" (regexp-opt org-todo-keywords-1 'words) "\\)?"
│ 		     " *\\(.*?\\)\\([ \t]:\\(?:" org-tag-re ":\\)+\\)?[ \t]*$"))
└────

The `(regexp-opt org-todo-keywords-1 'words)' excludes most of my TODO
keywords (but not all). Changing `'words' to `'symbols' give me my
desired result.

Short reproducer for some TODO keywords:

┌────
│ (let* ((todo-keywords '("TODO" "DONE" "PROJECT" "≣" "∎" "◇" "★" "⌛" "🔥" "⚙" "⎇" "⏵" "✔" "✘"))
│        (re-words (regexp-opt todo-keywords 'words))
│        (re-symbols (regexp-opt todo-keywords 'symbols)))
│   (list
│    (-map (lambda (kw) (when (string-match-p re-words kw) kw)) todo-keywords)
│    (-map (lambda (kw) (when (string-match-p re-symbols kw) kw)) todo-keywords)))
│ (("TODO" "DONE" "PROJECT" nil nil nil nil nil "🔥" "⚙" nil nil "✔" "✘")
│  ("TODO" "DONE" "PROJECT" "≣" "∎" "◇" "★" "⌛" "🔥" "⚙" "⎇" "⏵" "✔" "✘"))
└────

I have no idea why "⚙" is a word and "⌛" isn't, but would you accept a
patch that changes `'words' to `'symbols'? Or is there another way
around my problem?

~marcel



             reply	other threads:[~2022-09-01  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  8:17 Marcel Lauhoff [this message]
2022-09-03  8:14 ` Unicode TODO keyword issues in agenda search leading to org-scan-tags regex Ihor Radchenko
2022-09-05  9:53   ` Marcel Lauhoff
2022-09-05 10:29     ` Ihor Radchenko
2022-09-05 10:44       ` Marcel Lauhoff
2022-09-05 10:54         ` Ihor Radchenko
2022-09-06  7:11           ` Marcel Lauhoff

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=C5370FC1-ABBB-4FA1-8364-5B1DF0FB4755@irq0.org \
    --to=ml@irq0.org \
    --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).