branch: externals/denote commit 5d245dfca6b78cd89f2fc9a86d9743b3d4f4cd46 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Fix regexp to read non-ascii characters There were two simultaneous threads about this issue: 1. On the mailing list with Frank Ehmsen and Peter Prevos: <https://lists.sr.ht/~protesilaos/denote/%3C2273b3b1-344c-6c6e-3ab6-a227b6bc3721%40eh-is.de%3E>. 2. On the GitHub mirror with user hpgisler: <https://github.com/protesilaos/denote/issues/61>. This also relates to issue 57 on the GitHub mirror, with the participation of pRotOta1p: <https://github.com/protesilaos/denote/issues/57>. Thanks to everyone involved! --- denote-faces.el | 5 +++-- denote.el | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/denote-faces.el b/denote-faces.el index 48e3f75f9e..b58cc67610 100644 --- a/denote-faces.el +++ b/denote-faces.el @@ -82,10 +82,11 @@ and seconds." "Face for file name delimiters in Dired buffers." :group 'denote-faces) +;; For character classes, evaluate: (info "(elisp) Char Classes") (defvar denote-faces--file-name-regexp (concat "\\(?1:[0-9]\\{8\\}\\)\\(?2:T[0-9]\\{6\\}\\)" - "\\(?:\\(?3:--\\)\\(?4:[0-9A-Za-z-]*\\)\\)?" - "\\(?:\\(?5:__\\)\\(?6:[0-9A-Za-z_-]*\\)\\)?" + "\\(?:\\(?3:--\\)\\(?4:[[:alnum:]-]*\\)\\)?" + "\\(?:\\(?5:__\\)\\(?6:[[:alnum:]_-]*\\)\\)?" "\\(?7:\\..*\\)?$") "Regexp of file names for fontification.") diff --git a/denote.el b/denote.el index 45a31c88e1..2152c695a5 100644 --- a/denote.el +++ b/denote.el @@ -308,16 +308,17 @@ are described in the doc string of `format-time-string'." ;;;; Main variables +;; For character classes, evaluate: (info "(elisp) Char Classes") (defconst denote--id-format "%Y%m%dT%H%M%S" "Format of ID prefix of a note's filename.") (defconst denote--id-regexp "\\([0-9]\\{8\\}\\)\\(T[0-9]\\{6\\}\\)" "Regular expression to match `denote--id-format'.") -(defconst denote--title-regexp "--\\([0-9A-Za-z-]*\\)" - "Regular expression to match keywords.") +(defconst denote--title-regexp "--\\([[:alnum:]-]*\\)" + "Regular expression to match the title field.") -(defconst denote--keywords-regexp "__\\([0-9A-Za-z_-]*\\)" +(defconst denote--keywords-regexp "__\\([[:alnum:]_-]*\\)" "Regular expression to match keywords.") (defconst denote--extension-regexp "\\.\\(org\\|md\\|txt\\)"