branch: externals/hyperbole commit b2998ade3da449c84aafdb4d0b01ec3f0bf92e17 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
ert-should ibtype - Limit to single line when not ert-results-mode --- ChangeLog | 6 ++++++ hsys-ert.el | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d14abaf84..31aef3eb19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,12 @@ so does not include extra whitespace and matches the result when 'hui-select-thing' is called interactively. +* hsys-ert.el (ert-should): Constrain matches for this ibtype to the current + line when not in 'ert-results-mode'. This fixes a problem of having this + ibtype trigger in the "*scratch*" buffer for example where an + 'ert-test-failed match is found but it is far way and unconnected to the + current point. + * hycontrol.el (require 'zoom-frm): Wrap in an 'ignore-errors' so if its required library, 'frame-cmds' is not installed, no error occurs and HyControl behaves works without the library. diff --git a/hsys-ert.el b/hsys-ert.el index 81024f0a1d..c7adeef4b9 100644 --- a/hsys-ert.el +++ b/hsys-ert.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Jan-25 -;; Last-Mod: 20-Jan-25 at 23:57:21 by Mats Lidell +;; Last-Mod: 22-Feb-25 at 12:20:29 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -57,11 +57,15 @@ "Jump to the source code definition of a should expr from an ert test failure. If on the first line of a failure, jump to the source definition of the associated test." - (when (or (derived-mode-p 'ert-results-mode) - (save-excursion - (forward-line 0) - (or (search-backward "(ert-test-failed\n" nil t) - (search-forward "(ert-test-failed\n" nil t)))) + (when (or (and (derived-mode-p 'ert-results-mode) + (save-excursion + (forward-line 0) + (or (search-backward "(ert-test-failed\n" nil t) + (search-forward "(ert-test-failed\n" nil t)))) + ;; In any other mode, consider only the current line + (save-excursion + (forward-line 0) + (search-forward "(ert-test-failed" (line-end-position) t))) (catch 'exit (save-excursion (save-restriction