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
15 changes: 15 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
2026-04-12 Bob Weiner <rsw@gnu.org>

* hywiki.el (hywiki-cache-save):
test/hy-test-helpers.el (hy-delete-file-and-buffer): Suppress echo area and
*Messages* output of 'Wrote <filename' and use 'basic-save-buffer' instead
of 'save-buffer' to reduce backup files, etc.
hypb.el (hypb:save-buffer-silently): Add and use in 'hywiki-cache-save' and
throughout Hyperbole tests.

* test/hywiki-tests.el (hywiki-tests--save-referent-info-node-use-menu): Change
match to Info node from "(emacs)" to "(emacs)*" to get it to match.

* hibtypes.el (pathname): Eliminate matches to Elisp quoted symbols like
#'symbol or any use of quote marks after the leading optional # character.
hpath.el (hpath:find): Don't match as an anchor unless there are anchor
chars after the opening # char.

* kotl/kotl-mode.el (kotl-mode:split-cell): Fix extra blank line(s)
remaining after split a cell. Now removes all whitespace, including
newlines around the point where the split occurs.
Expand Down
4 changes: 2 additions & 2 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: 11-Apr-26 at 19:28:10 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 12:59:51 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -355,7 +355,7 @@ display options."
;; Match PATH-related Environment and Lisp variable names and
;; Emacs Lisp and Info files without any directory component.
(when (setq path orig-path)
(cond ((string-match "\\`#[^#]+" path)
(cond ((string-match "\\`#[^\]\[#+^{}<>\"`'\\\n\t\f\r]+" path)
(apply #'ibut:label-set path (hpath:start-end path))
(hact 'link-to-file path))
((and (string-match hpath:path-variable-regexp path)
Expand Down
11 changes: 7 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: 22-Mar-26 at 18:26:12 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 12:59:52 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -90,8 +90,10 @@ Group 3 is the 1-based line number. Group 5 is the 0-based column number.")
(defconst hpath:markup-link-anchor-regexp
"\\`\\(#?[^#+]*[^#+.]\\)?\\(#\\)\\([^\]\[#+^{}<>\"`'\\\n\t\f\r]*\\)"
"Regexp matching a filename followed by a hash (#) and an optional anchor name.
The anchor is an in-file reference. # is group 2. Group 3 is the anchor
name.")
The optional filename is group 1, though if it ends with a # then that
includes group 2. The anchor is an in-file reference. Its leading # is
group 2. Group 3 is the optional anchor name; if it is empty, then group 2
is part of the filename.")

(defvar hpath:path-variable-regexp "\\`\\$?[{(]?\\([-_A-Z]*path[-_A-Z]*\\)[)}]?\\'"
"Regexp that matches exactly to a standalone path variable name reference.
Expand Down Expand Up @@ -1590,7 +1592,8 @@ but locational suffixes within the file are utilized."
(string-to-number (match-string 3 path)))
path (substring path 0 (match-beginning 0)))))
(unless (file-exists-p path) ;; might be #autosave-file#
(when (string-match hpath:markup-link-anchor-regexp path)
(when (and (string-match hpath:markup-link-anchor-regexp path)
(not (string-empty-p (match-string 3 path))))
(setq hash t
anchor (match-string 3 path)
anchor-start-pos (match-beginning 3)
Expand Down
13 changes: 12 additions & 1 deletion hypb.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6-Oct-91 at 03:42:38
;; Last-Mod: 29-Mar-26 at 22:47:54 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 15:07:51 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1234,6 +1234,17 @@ Removes any trailing newline at the end of the output."
;;;###autoload
(defalias 'hypb:rgrep 'hui-select-rgrep)

;;;###autoload
(defun hypb:save-buffer-silently ()
"Silently save the current buffer whether modified or not."
(when (buffer-modified-p)
(let (
;; Prevent output to the echo area / stdout
(inhibit-message t)
;; Prevent writing to the *Messages* buffer
(message-log-max nil))
(basic-save-buffer))))

(defun hypb:save-lines (regexp)
"Save only lines containing match for REGEXP.
Apply within an active region or to the end of buffer."
Expand Down
4 changes: 2 additions & 2 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: 29-Mar-26 at 22:28:44 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 15:09:20 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -3251,7 +3251,7 @@ save and potentially set `hywiki--directory-mod-time' and
(hash-prin1 (hywiki-get-referent-hasht) nil t)
(princ ")\n")

(save-buffer)
(hypb:save-buffer-silently)
(if (buffer-modified-p)
(error "(hywiki-cache-save): Attempt to kill modified Environment file failed to save, \"%s\"" save-file)
(kill-buffer standard-output))))))
Expand Down
10 changes: 5 additions & 5 deletions test/hbut-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-may-21 at 09:33:00
;; Last-Mod: 1-May-25 at 23:33:16 by Mats Lidell
;; Last-Mod: 12-Apr-26 at 15:11:31 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -256,14 +256,14 @@ Create button with link-to-directory using `temporary-file-directory`."
;; Test with name
(setq annot-bib-buf (find-file annot-bib-file))
(ibut:program "name" 'annot-bib "arg")
(save-buffer)
(hypb:save-buffer-silently)
(should (string-match (concat (regexp-quote "<[name]> - [arg]")
"\\s-*")
(buffer-string)))
;; Test without name
(erase-buffer)
(ibut:program nil 'annot-bib "arg")
(save-buffer)
(hypb:save-buffer-silently)
(should (string-match (concat (regexp-quote "[arg]")
"\\s-*")
(buffer-string))))
Expand All @@ -279,14 +279,14 @@ Create button with link-to-directory using `temporary-file-directory`."
;; Test with name
(setq kbd-key-buf (find-file kbd-key-file))
(ibut:program "name" 'kbd-key "{ C-f C-f }")
(save-buffer)
(hypb:save-buffer-silently)
(should (string-match (concat (regexp-quote "<[name]> - { C-f C-f }")
"\\s-*")
(buffer-string)))
;; Test without name
(erase-buffer)
(ibut:program nil 'kbd-key "{ C-f C-f }")
(save-buffer)
(hypb:save-buffer-silently)
(should (string-match (concat (regexp-quote "{ C-f C-f }")
"\\s-*")
(buffer-string))))
Expand Down
4 changes: 2 additions & 2 deletions test/hpath-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 28-Feb-21 at 23:26:00
;; Last-Mod: 7-Mar-26 at 18:40:46 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 15:11:31 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -399,7 +399,7 @@
(progn
(find-file filename)
(insert "\"" fn "\"")
(save-buffer)
(hypb:save-buffer-silently)
(goto-char 3)
(should (string= (hpath:at-p) fn))
(should (string= (hpath:is-p fn) fn)))
Expand Down
6 changes: 3 additions & 3 deletions test/hui-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
;; Last-Mod: 14-Sep-25 at 19:26:09 by Mats Lidell
;; Last-Mod: 12-Apr-26 at 15:11:31 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -79,7 +79,7 @@
;; unsaved buffers are left open
(save-excursion
(set-buffer gbut-file-buffer)
(save-buffer))
(hypb:save-buffer-silently))
(hy-delete-file-and-buffer linked-file)
(when (file-writable-p hbmap:dir-user)
(delete-directory hbmap:dir-user t)))))
Expand Down Expand Up @@ -546,7 +546,7 @@ of the defun."
(progn
(find-file kotl-file)
(klink:create "1")
(save-buffer)
(hypb:save-buffer-silently)

(kotl-mode:beginning-of-cell)
(forward-char 1)
Expand Down
14 changes: 9 additions & 5 deletions test/hy-test-helpers.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
;; Last-Mod: 15-Mar-26 at 23:21:21 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 15:09:22 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand All @@ -19,8 +19,8 @@
;;; Code:

(require 'ert)
(require 'hmouse-drv) ; For `action-key'
(require 'hywiki) ; For `hywiki-word-face-at-p'
(require 'hmouse-drv) ;; For `action-key'
(require 'hywiki) ;; For `hywiki-word-face-at-p' and (require 'hypb)
(eval-when-compile (require 'cl-lib))

(defun hy-test-helpers:consume-input-events ()
Expand Down Expand Up @@ -93,11 +93,15 @@ Checks ACTYPE, ARGS, LOC, LBL-KEY and NAME."

(defun hy-delete-file-and-buffer (file)
"Delete FILE and buffer visiting file."
(let ((buf (find-buffer-visiting file)))
(let ((buf (find-buffer-visiting file))
;; Prevents output to the echo area / stdout
(inhibit-message t)
;; Prevents writing to the *Messages* buffer
(message-log-max nil))
(when buf
(with-current-buffer buf
(when (buffer-modified-p)
(save-buffer)
(hypb:save-buffer-silently)
;; If the save failed, ensure it shows non-modified before
;; trying to kill it.
(set-buffer-modified-p nil))
Expand Down
4 changes: 2 additions & 2 deletions test/hyrolo-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
;; Last-Mod: 11-Apr-26 at 19:28:11 by Bob Weiner
;; Last-Mod: 12-Apr-26 at 15:11:30 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -871,7 +871,7 @@ optional DEPTH the number of sub cells are created to that depth."
(insert (format "%s %d" heading (1+ d)))
(kotl-mode:newline 1)
(insert (format "%s %d" body (1+ d)))))
(save-buffer)
(hypb:save-buffer-silently)
kotl-file))

(ert-deftest hyrolo-tests--outline-next-visible-heading-kotl ()
Expand Down
Loading