branch: externals/hyperbole commit 7670cfb36a484d6543f2e393f94c5329a716f880 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
hibtypes.el - Add new 'hywiki-existing-word' ibtype Separates handling of this from HyWikiWords that don't yet have pages. --- ChangeLog | 7 +++++++ hibtypes.el | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 59f383b6bc..38dfe0dc68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-08-18 Bob Weiner <r...@gnu.org> + +* hibtypes.el (hywiki-existing-word): Add this new ibtype to match to + HyWikiWords with an existing page at a higher priority than those + without an existing page, so can be handled separately. Must be + defined in this file to set its priority at a high level. + * hywiki.el (hywiki-is-wikiword): Rename to 'hywiki-word-is-p'. (hywiki-word-activate , hywiki-page-strip-section, hywiki-page-exists-p): Add. diff --git a/hibtypes.el b/hibtypes.el index 78742fa0da..781ac4ee56 100644 --- a/hibtypes.el +++ b/hibtypes.el @@ -1632,6 +1632,21 @@ If a boolean function or variable, display its value." (apply #'actype:eval actype args))) (error "(action:help): No action button labeled: %s" label))))) +;;; ======================================================================== +;;; Activates HyWikiWords with existing HyWiki pages. +;;; Non-existing HyWikiWords are handled by the (load "hywiki") at a low +;;; priority earlier in this file which defines the `hywiki-word' ibtype. +;;; ======================================================================== + +(defib hywiki-existing-word () + "When on a HyWiki word with an existing page, display its page and optional section." + (cl-destructuring-bind (page-name start end) + (hywiki-page-exists-p 'range) + (when page-name + (when (and start end) + (ibut:label-set page-name (match-beginning 0) (match-end 0))) + (hact 'hywiki-find-page page-name)))) + ;;; ======================================================================== ;;; Inserts completion into minibuffer or other window. ;;; ========================================================================