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
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2026-03-22 Bob Weiner <rsw@gnu.org>

* hibtypes.el (hib-link-to-file-line): Fix that a filename both in the current
dir and in the 'load-path' variable is expanded into a 'load-path' dir
first rather than the current directory, which should be preferred.

* hpath.el (hpath:find): Fix (let ((buf))) when (string-empty-p path) to
return the current buffer when 'hpath:display-buffer' is called. Fixes
bug where that function returned a window instead.

* hywiki.el (hywiki-get-referent-hasht): Remove rebuild of referent-hasht
when empty. This was causing a problem in the
'hywiki-tests--save-referent-org-id'.

2026-03-21 Bob Weiner <rsw@gnu.org>

* hypb.el (hypb:grep-has-pcre-p, hypb:ripgrep-has-pcre-p): Add.
Expand Down
26 changes: 16 additions & 10 deletions hibtypes.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 20:45:31
;; Last-Mod: 17-Mar-26 at 19:48:06 by Bob Weiner
;; Last-Mod: 22-Mar-26 at 14:08:04 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1013,14 +1013,20 @@ See `hpath:find' function documentation for special file display options."
"Expand FILE and jump to its LINE-NUM in Hyperbole specified window.
The variable `hpath:display-where' determines where to display the file.
LINE-NUM may be an integer or string."
;; RSW 12-05-2021 - Added hpath:expand in next line to
;; resolve any variables in the path before checking if absolute.
(let ((source-loc (unless (file-name-absolute-p (hpath:expand file))
(hbut:to-key-src t)))
ext)
(if (stringp source-loc)
(setq file (expand-file-name file (file-name-directory source-loc)))
(setq file (or (hpath:prepend-shell-directory file)
;; RSW 12-05-2021 - Add hpath:expand in next line to resolve any variables
;; in the path before checking if absolute.
;; RSW 03-22-2026 - Save expanded-file and use if absolute in order to
;; prefer files found in current directory over those in a `load-path' dir.
(let ((expanded-file (hpath:expand file))
source-loc)
(unless (and (stringp expanded-file) (file-name-absolute-p expanded-file))
(setq expanded-file nil))
(setq source-loc (unless expanded-file (hbut:to-key-src t)))
(cond (expanded-file
(setq file expanded-file))
((stringp source-loc)
(setq file (expand-file-name file (file-name-directory source-loc))))
(t (setq file (or (hpath:prepend-shell-directory file)
;; find-library-name will strip file
;; suffixes, so use it only when the file
;; either doesn't have a suffix or has a
Expand All @@ -1029,7 +1035,7 @@ LINE-NUM may be an integer or string."
(member (concat "." ext) (get-load-suffixes)))
(ignore-errors (find-library-name file)))
(hpath:is-p (expand-file-name file))
(hywiki-get-existing-page-file file))))
(hywiki-get-existing-page-file file)))))
(when (file-exists-p (hpath:normalize file))
(actypes::link-to-file-line file line-num))))

Expand Down
8 changes: 4 additions & 4 deletions hpath.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 1-Nov-91 at 00:44:23
;; Last-Mod: 17-Mar-26 at 22:51:48 by Bob Weiner
;; Last-Mod: 22-Mar-26 at 13:41:04 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1625,9 +1625,9 @@ but locational suffixes within the file are utilized."
;; If no path, e.g. just an anchor link in a non-file buffer,
;; then must display within Emacs, ignoring any external programs.
((string-empty-p path)
(if noselect
(current-buffer)
(hpath:display-buffer (current-buffer) display-where)))
(unless noselect
(hpath:display-buffer (current-buffer) display-where))
(current-buffer))
(noselect
(find-file-noselect path))
(t (funcall (hpath:display-path-function display-where) path)))))
Expand Down
7 changes: 3 additions & 4 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: 22-Mar-26 at 01:34:22 by Bob Weiner
;; Last-Mod: 22-Mar-26 at 12:53:00 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1461,8 +1461,8 @@ Use `hywiki-get-referent' to determine whether a HyWiki page exists."
current-prefix-arg))
(if (hywiki-word-is-p page-name)
(when (or noninteractive
(not (hash-empty-p (hywiki-get-referent-hasht)))
(hyperb:stack-frame '(ert-run-test))
(not (hash-empty-p (hywiki-get-referent-hasht)))
(y-or-n-p (concat "Create new HyWiki page `" page-name "'? ")))
;; Remove any #section suffix in PAGE-NAME.
(setq page-name (hywiki-get-singular-wikiword page-name))
Expand Down Expand Up @@ -3076,8 +3076,7 @@ regexps of wikiwords, if the hash table is out-of-date."
(if (and (equal hywiki--pages-directory hywiki-directory)
;; If page files changed, have to rebuild referent hash table
(not (hywiki-directory-modified-p))
(hash-table-p hywiki--referent-hasht)
(not (hash-empty-p hywiki--referent-hasht)))
(hash-table-p hywiki--referent-hasht))
hywiki--referent-hasht
;; Rebuild referent hash table
(hywiki-make-referent-hasht))
Expand Down
3 changes: 1 addition & 2 deletions test/hywiki-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -1474,8 +1474,7 @@ Note special meaning of `hywiki-allow-plurals-flag'."
(hywiki-tests--insert "* header\n")
(mocklet (((org-id-get) => "generated-org-id"))
(goto-char (point-max))
(hywiki-add-referent wiki-word-non-page
(hywiki-add-org-id wiki-word-non-page))))
(hywiki-add-org-id wiki-word-non-page)))
(hy-delete-file-and-buffer filea))))))

;; !! FIXME: Add Org-id links tests.
Expand Down
Loading