From d8c600e9e5b6361312017bb0614334d20f6d28f9 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Fri, 24 Apr 2026 18:51:12 +0200 Subject: [PATCH] update hl-todo --- .../hl-todo-autoloads.el | 8 +- .../hl-todo-pkg.el | 8 +- .../hl-todo.el | 80 +++++++++++++++---- 3 files changed, 71 insertions(+), 25 deletions(-) rename elpa/{hl-todo-20250301.1643 => hl-todo-20250923.937}/hl-todo-autoloads.el (97%) rename elpa/{hl-todo-20250301.1643 => hl-todo-20250923.937}/hl-todo-pkg.el (69%) rename elpa/{hl-todo-20250301.1643 => hl-todo-20250923.937}/hl-todo.el (88%) diff --git a/elpa/hl-todo-20250301.1643/hl-todo-autoloads.el b/elpa/hl-todo-20250923.937/hl-todo-autoloads.el similarity index 97% rename from elpa/hl-todo-20250301.1643/hl-todo-autoloads.el rename to elpa/hl-todo-20250923.937/hl-todo-autoloads.el index 89db67d2..9400ad02 100644 --- a/elpa/hl-todo-20250301.1643/hl-todo-autoloads.el +++ b/elpa/hl-todo-20250923.937/hl-todo-autoloads.el @@ -41,7 +41,10 @@ either customize it (see the info node `Easy Customization') or call the function `global-hl-todo-mode'.") (custom-autoload 'global-hl-todo-mode "hl-todo" nil) (autoload 'global-hl-todo-mode "hl-todo" "\ -Toggle Hl-Todo mode in all buffers. +Toggle Hl-Todo mode in many buffers. +Specifically, Hl-Todo mode is enabled in all buffers where +`hl-todo--turn-on-mode-if-desired' would do it. + With prefix ARG, enable Global Hl-Todo mode if ARG is positive; otherwise, disable it. @@ -49,9 +52,6 @@ If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. -Hl-Todo mode is enabled in all buffers where -`hl-todo--turn-on-mode-if-desired' would do it. - See `hl-todo-mode' for more information on Hl-Todo mode. (fn &optional ARG)" t) diff --git a/elpa/hl-todo-20250301.1643/hl-todo-pkg.el b/elpa/hl-todo-20250923.937/hl-todo-pkg.el similarity index 69% rename from elpa/hl-todo-20250301.1643/hl-todo-pkg.el rename to elpa/hl-todo-20250923.937/hl-todo-pkg.el index f76dcffa..fa8607a1 100644 --- a/elpa/hl-todo-20250301.1643/hl-todo-pkg.el +++ b/elpa/hl-todo-20250923.937/hl-todo-pkg.el @@ -1,11 +1,11 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "hl-todo" "20250301.1643" +(define-package "hl-todo" "20250923.937" "Highlight TODO and similar keywords." '((emacs "26.1") - (compat "30.0.2.0")) + (compat "30.1")) :url "https://github.com/tarsius/hl-todo" - :commit "0ce21c329b686802121df45bf4ae15ae201137bf" - :revdesc "0ce21c329b68" + :commit "0df1c09b643c36ed8ab911b4b1865e0360a2dfc3" + :revdesc "0df1c09b643c" :keywords '("convenience") :authors '(("Jonas Bernoulli" . "emacs.hl-todo@jonas.bernoulli.dev")) :maintainers '(("Jonas Bernoulli" . "emacs.hl-todo@jonas.bernoulli.dev"))) diff --git a/elpa/hl-todo-20250301.1643/hl-todo.el b/elpa/hl-todo-20250923.937/hl-todo.el similarity index 88% rename from elpa/hl-todo-20250301.1643/hl-todo.el rename to elpa/hl-todo-20250923.937/hl-todo.el index 85589fa1..d2d5a401 100644 --- a/elpa/hl-todo-20250301.1643/hl-todo.el +++ b/elpa/hl-todo-20250923.937/hl-todo.el @@ -6,9 +6,9 @@ ;; Homepage: https://github.com/tarsius/hl-todo ;; Keywords: convenience -;; Package-Version: 20250301.1643 -;; Package-Revision: 0ce21c329b68 -;; Package-Requires: ((emacs "26.1") (compat "30.0.2.0")) +;; Package-Version: 20250923.937 +;; Package-Revision: 0df1c09b643c +;; Package-Requires: ((emacs "26.1") (compat "30.1")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -56,6 +56,9 @@ (declare-function grep-read-files "grep" (regexp)) (declare-function flymake-make-diagnostic "flymake") +(define-obsolete-variable-alias 'hl-todo--syntax-table + 'hl-todo-syntax-table "Hl-Todo 3.9.0") + (defgroup hl-todo nil "Highlight TODO and similar keywords in comments and strings." :group 'font-lock-extra-types) @@ -127,7 +130,7 @@ Instead of a color (a string), each COLOR may alternatively be a face. The syntax class of the characters at either end has to be `w' -\(which means word) in `hl-todo--syntax-table' (which derives +\(which means word) in `hl-todo-syntax-table' (which derives from `text-mode-syntax-table'). This package, like most of Emacs, does not use POSIX regexp @@ -179,6 +182,38 @@ controls which of the two it is." :group 'hl-todo :type 'boolean) +(defcustom hl-todo-keyword-delimiters 'symbol + "Delimiters placed around the regexp used to match keywords. + +`symbol' + The part of the regexp used to match keywords is surrounded by + \\_< and \\_>. This is the default. + +`word' + The part of the regexp used to match keywords is surrounded by + \\< and \\>. Use this if you want the TODO in foo-TODO_bar to + be highlighted. + +`nil' + The part of the regexp used to match keywords is not surrounded + by any delimiters. Use this if you want the TODO in fooTODObar + to be highlighted. + +`hl-todo-rgrep' uses \\< and \\> for `symbol' as well, because grep +does not support \\_< and \\_>. + +If you want to prevent keyword fontification if certain characters +appear next to them, then you have to modify `hl-todo-syntax-table'. +For example, if you do not want the TODO in !TODO to be highlighted, +use the symbol (`_') syntax class for the ! character. + + (modify-syntax-entry ?! \"_\" hl-todo--syntax-table)" + :package-version '(hl-todo . "3.9.0") + :group 'hl-todo + :type '(choice (const :tag "Wrap with \\_<...\\_>" symbol) + (const :tag "Wrap with \\<...\\>" word) + (const :tag "No delimiters" nil))) + (defcustom hl-todo-wrap-movement nil "Whether movement commands wrap around when there are no more matches." :package-version '(hl-todo . "3.4.0") @@ -204,17 +239,22 @@ including alphanumeric characters, cannot be used here." :group 'hl-todo :type 'boolean) +(defvar hl-todo-syntax-table (copy-syntax-table text-mode-syntax-table) + "Syntax table used while searching for TODO keywords. +This is used instead of the buffer's local syntax table and derives +from `text-mode-syntax-table'.") + (defvar hl-todo--keywords `((,(lambda (bound) (hl-todo--search nil bound)) (1 (hl-todo--get-face) prepend t)))) (defvar-local hl-todo--regexp nil) -(defsubst hl-todo--regexp () +(defsubst hl-todo--regexp (&optional no-symbol) "Return regular expression matching TODO or similar keyword." - (or hl-todo--regexp (hl-todo--setup-regexp))) + (or hl-todo--regexp (hl-todo--setup-regexp no-symbol))) -(defun hl-todo--setup-regexp () +(defun hl-todo--setup-regexp (&optional no-symbol) "Setup keyword regular expression. See the function `hl-todo--regexp'." (when-let ((bomb (assoc "???" hl-todo-keyword-faces))) @@ -224,16 +264,23 @@ See the function `hl-todo--regexp'." ;; in the regexp search taking forever. (setq hl-todo-keyword-faces (delete bomb hl-todo-keyword-faces))) (setq hl-todo--regexp - (concat "\\(\\<" + (concat "\\(" + (pcase hl-todo-keyword-delimiters + ('symbol (if no-symbol "\\<" "\\_<")) + ('word "\\<") + (_ "")) "\\(" (mapconcat #'car hl-todo-keyword-faces "\\|") "\\)" - "\\>" + (pcase hl-todo-keyword-delimiters + ('symbol (if no-symbol "\\>" "\\_>")) + ('word "\\>") + (_ "")) (and (not (equal hl-todo-highlight-punctuation "")) (concat "[" hl-todo-highlight-punctuation "]" - (if hl-todo-require-punctuation "+" "*"))) + (if hl-todo-require-punctuation + (if no-symbol "\\+" "+") + "*"))) "\\)"))) -(defvar hl-todo--syntax-table (copy-syntax-table text-mode-syntax-table)) - (defun hl-todo--search (&optional regexp bound backward) "Search for keyword REGEXP, optionally up to BOUND and BACKWARD. If REGEXP is not given, it defaults to the return value of the @@ -243,7 +290,7 @@ function `hl-todo--regexp'." (cl-block nil (while (let ((case-fold-search nil) (syntax-ppss-table (syntax-table))) - (with-syntax-table hl-todo--syntax-table + (with-syntax-table hl-todo-syntax-table (funcall (if backward #'re-search-backward #'re-search-forward) regexp bound t))) (cond ((or (apply #'derived-mode-p hl-todo-text-modes) @@ -289,8 +336,7 @@ If COLOR is a face symbol, do not combine, return COLOR instead." (if hl-todo-mode (font-lock-add-keywords nil hl-todo--keywords t) (font-lock-remove-keywords nil hl-todo--keywords)) - (when font-lock-mode - (jit-lock-mode 1))) + (font-lock-flush)) ;;;###autoload (define-globalized-minor-mode global-hl-todo-mode @@ -367,7 +413,7 @@ because it uses a regexp instead of a more sophisticated matcher. It also finds occurrences that are not within a string or comment." (interactive) - (with-syntax-table hl-todo--syntax-table + (with-syntax-table hl-todo-syntax-table (occur (hl-todo--regexp)))) ;;;###autoload @@ -387,7 +433,7 @@ Also see option `hl-todo-keyword-faces'." (grep-compute-defaults) (unless grep-find-template (error "grep.el: No `grep-find-template' available")) - (let ((regexp (with-temp-buffer (hl-todo--regexp)))) + (let ((regexp (with-temp-buffer (hl-todo--regexp t)))) (list regexp (grep-read-files regexp) (read-directory-name "Base directory: " nil default-directory t) -- 2.47.3