From 2c4f617889d17e79740e2436a8acefcdd18d39b2 Mon Sep 17 00:00:00 2001 From: bw Date: Thu, 18 Jun 2026 09:17:16 -0400 Subject: [PATCH] hywiki-include-special-modes - Find WikiWords in these special modes hywiki-potential-buffer-p uses this. --- ChangeLog | 6 ++++++ hywiki.el | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1e69c0b..c36e38f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-06-18 Bob Weiner + +* hywiki.el (hywiki-include-special-modes): Add to recognize HyWikiWords in + particular special major modes, like eww and elfeed ones. + (hywiki-potential-buffer-p): Use above setting in this function. + 2026-06-16 Bob Weiner * test/demo-tests.el (fast-demo-display-kotl-starting-from-cell): Fix to diff --git a/hywiki.el b/hywiki.el index 3b782844..36a891ba 100644 --- a/hywiki.el +++ b/hywiki.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Apr-24 at 22:41:13 -;; Last-Mod: 15-Jun-26 at 18:10:04 by Bob Weiner +;; Last-Mod: 18-Jun-26 at 09:15:55 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -314,7 +314,9 @@ Group 1 is the entire HyWikiWord#section:Lnum:Cnum expression.") #'hywiki--clear-buttonize-characters-cache) (defcustom hywiki-exclude-major-modes nil - "List of major modes to exclude from HyWikiWord highlighting and recognition." + "List of major modes to exclude from HyWikiWord highlighting and recognition. +Any `special' major mode, like Dired, is automatically excluded unless +included in the list, `hywiki-include-special-modes'." :type '(list symbol) :group 'hyperbole-hywiki) @@ -323,6 +325,14 @@ Group 1 is the entire HyWikiWord#section:Lnum:Cnum expression.") :type '(list symbol) :group 'hyperbole-hywiki) +(defcustom hywiki-include-special-modes + '(elfeed-search-mode elfeed-show-mode eww-mode kotl-mode) + "List of `special' major modes to include in HyWikiWord highlighting and recognition. +By default, all special modes, like Dired, are excluded. A major mode +included here will override its inclusion in `hywiki-exclude-major-modes'." + :type '(list symbol) + :group 'hyperbole-hywiki) + (defcustom hywiki-mode-lighter " HyWiki" "String to display in mode line when the HyWiki global minor mode is enabled. Use nil for no HyWiki mode indicator." @@ -1184,12 +1194,11 @@ Exclude the minibuffer if selected and return nil." Always exclude minibuffers. This does not mean `hywiki-mode' is presently active in that buffer; use `hywiki-active-in-current-buffer-p' for that." - (and (not (minibufferp)) ;; (not (and (boundp 'edebug-active) edebug-active)) - (not (apply #'derived-mode-p hywiki-exclude-major-modes)) - (or (derived-mode-p 'kotl-mode) - (not (eq (get major-mode 'mode-class) 'special))))) + (or (apply #'derived-mode-p hywiki-include-special-modes) + (and (not (eq (get major-mode 'mode-class) 'special)) + (not (apply #'derived-mode-p hywiki-exclude-major-modes)))))) (defun hywiki-add-activity (wikiword) "Make WIKIWORD resume a prompted for activity.