Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
2026-06-20 Mats Lidell <matsl@gnu.org>
2026-06-25 Bob Weiner <rsw@gnu.org>

* test/hibtypes-tests.el: Add !!FIXME comments to highlight the ibtypes
where tests should be added.
* test/hywiki-tests.el (hywiki-tests--command): Fix interactive call
which was missing wikiword argument.

* hywiki.el (hywiki-add-command, hywiki-display-command): Generalize
to handle the arguments of any Emacs command or Hyperbole actype.
Now a referent can be any type of Hyperbole button action.
test/hywiki-tests.el (hywiki-tests--add-command): Update to handle
above changes.

* hywiki.el (hywiki-referent-menu): Extend 'Create' doc string to explain
how to get a prompt for a referent type rather than just linking
to a HyWiki page.
man/hyperbole.texi (HyWiki Menu): Extend 'Create' doc and document all
potentially prompted for HyWikiWord referent types.

* hmouse-drv.el (hkey-help): When on a HyWikiWord, include attributes
'referent-type' and 'referent-value' in help display.

2026-06-24 Bob Weiner <rsw@gnu.org>

Expand All @@ -17,6 +32,9 @@

2026-06-20 Mats Lidell <matsl@gnu.org>

* test/hibtypes-tests.el: Add !!FIXME comments to highlight the ibtypes
where tests should be added.

* test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file)
(ibtypes::ilink-error-case-missing-button)
(ibtypes::elink-ebut-in-other-file): Add tests.
Expand Down Expand Up @@ -10482,7 +10500,7 @@ name with 'name' and 'name-key'.
with 'hpath:symlink-referent'.
(smart-symlink-expand): Remove this function.

* hbut.el (ibut:to-text): Fix so does not move point if lbl-key end up nil.
* hbut.el (ibut:to-text): Fix so does not move point if lbl-key ends up nil.

2023-01-28 Bob Weiner <rsw@gnu.org>

Expand Down
4 changes: 2 additions & 2 deletions README.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
look <a href="stable/hyperbole.html">here</a>.]</p>
<p>[We work on Hyperbole as a gift to the Emacs community and request
you send us a thank you or a testimonial describing your usage if you
like Hyperbole to <a
href="mailto:rsw@gnu.org"><span>rsw@gnu.org</span></a>].</p>
like Hyperbole to <a href="mailto:rsw@gnu.org"><a
href="mailto:rsw@gnu.org">rsw@gnu.org</a></a>].</p>
<ul>
<li><a
href="#gnu-hyperbole-902pre---the-everyday-hypertextual-information-manager">GNU
Expand Down
6 changes: 3 additions & 3 deletions hbut.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 18-Sep-91 at 02:57:09
;; Last-Mod: 14-Jun-26 at 15:13:00 by Bob Weiner
;; Last-Mod: 24-Jun-26 at 19:47:03 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -450,7 +450,7 @@ button is found in the current buffer."

;; Error when on a read-only part of a buffer's text
(when (plist-member (text-properties-at (point)) 'read-only)
(hypb:error "(ebut:operate): Point must not be on a read-only Org element"))
(hypb:error "(ebut:operate): Point must not be on a read-only text section"))
;; Error when on an implicit button
(when (or (eq (hattr:get 'hbut:current 'categ) 'implicit)
(string-prefix-p "ibtypes::" (symbol-name (hattr:get 'hbut:current 'categ))))
Expand Down Expand Up @@ -2543,7 +2543,7 @@ Summary of operations based on inputs (name arg from \\='hbut:current attrs):

;; Error when on a read-only part of a buffer's text
(when (plist-member (text-properties-at (point)) 'read-only)
(hypb:error "(ibut:operate): Point must not be on a read-only Org element"))
(hypb:error "(ibut:operate): Point must not be on a read-only text section"))
;; Error when on an explicit button
(when (eq (hattr:get 'hbut:current 'categ) 'explicit)
(hypb:error "(ibut:operate): Point must not be on an explicit button: %s"
Expand Down
14 changes: 12 additions & 2 deletions hmouse-drv.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 04-Feb-90
;; Last-Mod: 28-Sep-25 at 12:22:16 by Bob Weiner
;; Last-Mod: 25-Jun-26 at 08:53:26 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1177,7 +1177,17 @@ documentation is found."
(categ (hattr:get 'hbut:current 'categ))
(attributes (nthcdr 2 (hattr:list 'hbut:current)))
(but-def-symbol (htype:def-symbol
(if (eq categ 'explicit) actype categ))))
(if (eq categ 'explicit) actype categ)))
(wikiword-referent
(when (eq (htype:def-symbol actype) 'link-to-wikiword)
(hywiki-get-referent
(hattr:get 'hbut:current 'lbl-key)))))

(when wikiword-referent
(hattr:set 'hbut:current 'referent-type
(car wikiword-referent))
(hattr:set 'hbut:current 'referent-value
(cdr wikiword-referent)))

(princ (format "%s %s SPECIFICS:\n"
(or but-def-symbol
Expand Down
7 changes: 5 additions & 2 deletions hui-mini.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 15-Oct-91 at 20:13:17
;; Last-Mod: 22-Mar-26 at 23:15:20 by Bob Weiner
;; Last-Mod: 25-Jun-26 at 09:52:07 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1064,7 +1064,10 @@ support underlined faces as well."
'("BacklinkConsult" hywiki-consult-backlink
"Use Consult to select a backlink (reference) to a prompted for HyWikiWord."))
'("Create" hywiki-word-create-and-display
"Create and display a new or existing HyWikiWord referent, prompting with any existing referent names.")
"Create and display a new or existing HyWikiWord referent, prompting with any existing referent names.
With either `hywiki-referent-prompt-flag' set or optional prefix ARG,
prompt for and choose a typed referent, otherwise, create and/or display
a HyWiki page. See `hywiki-referent-menu' for valid referent types.")
'("DiredHyWiki" hywiki-directory-edit
"Display and edit HyWiki directory.")
'("EditPage" hywiki-find-page
Expand Down
4 changes: 2 additions & 2 deletions hui.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 21:42:03
;; Last-Mod: 19-Jun-26 at 00:26:54 by Bob Weiner
;; Last-Mod: 25-Jun-26 at 09:58:50 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1655,7 +1655,7 @@ Trigger an error if DEFAULT-ACTYPE is invalid."
(with-current-buffer but-buf
(when buffer-read-only
(setq err
(format "(%s) Read-only error in Hyperbole button buffer '%s'. Use {%s} to enable edits."
(format "(%s) Read-only error in buffer '%s'. Use {%s} to enable edits."
func-name (buffer-name but-buf) (hmouse-read-only-toggle-key)))))
(when err
(pop-to-buffer but-buf)
Expand Down
56 changes: 35 additions & 21 deletions hywiki.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 21-Apr-24 at 22:41:13
;; Last-Mod: 18-Jun-26 at 09:15:55 by Bob Weiner
;; Last-Mod: 25-Jun-26 at 13:00:30 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -327,7 +327,7 @@ included in the list, `hywiki-include-special-modes'."

(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.
"List of `special' major modes with 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)
Expand Down Expand Up @@ -1089,7 +1089,7 @@ After successfully finding a referent, run `hywiki-display-referent-hook'."
(delq nil
(list
'("HyWiki Add>")
(when (fboundp #'activities-new)
(when (fboundp #'activities-new)
'("Activity" (hywiki-add-activity hkey-value)
"Add a HyWikiWord that activates a saved activity from the Activities package."))
'("Bookmark" (hywiki-add-bookmark hkey-value)
Expand Down Expand Up @@ -1127,7 +1127,8 @@ After successfully finding a referent, run `hywiki-display-referent-hook'."
'("orgRoamNode" (hywiki-add-org-roam-node hkey-value)
"Add a HyWikiWord that displays an Org Roam node given its title.")
'("Sexp" (hywiki-add-sexpression hkey-value)
"Add a HyWikiWord that evaluates an Elisp sexpression.")))
"Add a HyWikiWord that evaluates an Elisp sexpression.")
))
"Menu of HyWikiWord custom referent types of the form:
\(LABEL-STRING ACTION-SEXP DOC-STR)."
:set (lambda (var value) (set-default var value))
Expand Down Expand Up @@ -1158,8 +1159,8 @@ an error is triggered."

(defun hywiki-create-referent (wikiword &optional message-flag)
"Prompt for, add to HyWiki lookups and return a WIKIWORD custom referent.
With optional prefix arg MESSAGE-FLAG non-nil, display a minibuffer message
with the referent."
With optional prefix arg MESSAGE-FLAG non-nil or when called interactively,
display a minibuffer message with the referent."
(interactive (list nil current-prefix-arg))
(unless (stringp wikiword)
(setq wikiword (hywiki-word-read-new "Create/Edit HyWikiWord: ")))
Expand Down Expand Up @@ -1201,7 +1202,7 @@ use `hywiki-active-in-current-buffer-p' for that."
(not (apply #'derived-mode-p hywiki-exclude-major-modes))))))

(defun hywiki-add-activity (wikiword)
"Make WIKIWORD resume a prompted for activity.
"Make WIKIWORD resume a prompted for, existing activity.

If WIKIWORD is invalid, trigger a `user-error' if called interactively
or return nil if not.
Expand Down Expand Up @@ -1249,10 +1250,10 @@ calling this function."
(bookmark-jump bookmark)))

(defun hywiki-add-command (wikiword)
"Set a custom command symbol for WIKIWORD and return it.
Command is the symbol used in the definition expression, which
may be an Emacs command or a Hyperbole action type. When invoked,
it receives the single argument of WIKIWORD.
"Make WIKIWORD invoke a prompted for command with arguments and return it.
Interactively, use any existing HyWikiWord at point or read an existing or
valid new one. Command is the symbol used in the definition expression,
which may be an Emacs command or a Hyperbole action type.

If WIKIWORD is invalid, trigger a `user-error' if called interactively
or return nil if not.
Expand All @@ -1263,13 +1264,25 @@ Use `hywiki-get-referent' to determine whether WIKIWORD exists prior to
calling this function."
(interactive (list (or (hywiki-word-at)
(hywiki-word-read-new "Add/Edit HyWikiWord: "))))
(let ((command (hui:actype nil (format "Command for %s: " wikiword))))
(hywiki-add-referent wikiword (cons 'command command))))
(when (string-empty-p wikiword)
(error "(hywiki-add-command): No HyWikiWord specified"))

(let* ((command (hui:actype nil (format "Command for %s: " wikiword)))
(args (hargs:actype-get command)))
(hywiki-add-referent wikiword
(if (equal args (list wikiword))
(cons 'command command)
(cons 'command (cons command args))))))

(defun hywiki-display-command (wikiword command)
(if (fboundp command)
(actype:act command wikiword)
(error "(hywiki-display-command): Unbound referent command, '%s'" command)))
(cond ((consp command)
;; arbitrary list of arguments
(apply 'actype:act command))
((symbolp command)
;; single arg of wikiword is sent to command
(actype:act command wikiword))
(t (error "(hywiki-display-command): Unbound referent command, '%s'"
command))))

(defun hywiki-add-find (wikiword)
"Make WIKIWORD grep across `hywiki-directory' for matches to itself.
Expand Down Expand Up @@ -1523,13 +1536,14 @@ Use `hywiki-get-referent' to determine whether a HyWiki page exists."
(user-error "(hywiki-add-page): Invalid HyWikiWord: '%s'; must be capitalized, all alpha" page-name))))

;;;###autoload
(defun hywiki-word-create (wikiword &optional arg)
(defun hywiki-word-create (wikiword &optional ref-type-flag)
"Create a HyWiki referent for WIKIWORD and return it; don't display it.
This replaces any existing referent the WIKIWORD may have.

With either `hywiki-referent-prompt-flag' set or optional prefix ARG,
prompt for and choose a typed referent, otherwise, create and/or display
a HyWiki page. See `hywiki-referent-menu' for valid referent types.
With either `hywiki-referent-prompt-flag' set or optional prefix
REF-TYPE-FLAG, prompt for and choose a typed referent, otherwise, create
and/or display a HyWiki page. See `hywiki-referent-menu' for valid referent
types.

Use `hywiki-get-referent' to test for and retrieve an existing HyWikiWord
referent."
Expand All @@ -1542,7 +1556,7 @@ referent."
"referent"
"page"))))
current-prefix-arg))
(if (or arg hywiki-referent-prompt-flag)
(if (or ref-type-flag hywiki-referent-prompt-flag)
(hywiki-create-referent wikiword t)
(hywiki-create-page wikiword t)))

Expand Down
Loading