branch: externals/hyperbole commit eaad29f6e451b0cdf4128671a6096362afae4873 Merge: 8f3c6ad3f5 575f988b41 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Merge branch 'master' into rsw --- ChangeLog | 21 +++++++++++++ hui-mouse.el | 31 +++++++++++------- man/.dir-locals.el | 33 +++++++++---------- man/hyperbole.texi | 13 +++++--- test/hui-tests.el | 84 +++++++++++++++++++++++++++++++++++++++++++++++-- test/hy-test-helpers.el | 3 +- test/hywiki-tests.el | 21 ++++++++++++- 7 files changed, 170 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed8528de04..38293d1939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,27 @@ search for delimiters. The use case for this function does not require looking back to the previous line. +2025-06-26 Mats Lidell <ma...@gnu.org> + +* man/.dir-locals.el: Use with-locale-environment to ensure English is + used for month names. +* man/hyperbole.texi: Insert auto-replace-on-save marker comment for date + update on save. Needed for the date in info pages. + +* hui-mouse.el (smart-magit): Add jump to worktree file when action press on + `+' char in magit-status-mode or magit-revision-mode. +* man/hyperbole.texi (Smart Key - Magit Mode): Update docs with jump to + worktree. + +2025-06-24 Mats Lidell <ma...@gnu.org> + +* test/hui-tests.el (hui--kill-region-delimited-text-and-yank-back) + (hui--select-boundaries): Add tests. + +* test/hywiki-tests.el (hywiki-tests--create-wikiword-file-highlights-wikiword): + Verify creating a file for WikiWord highlights the instances of + WikiWord that already is present in other files. + 2025-06-22 Bob Weiner <r...@gnu.org> * hproperty.el (hproperty:but-get-first-in-region): Change from returning a list diff --git a/hui-mouse.el b/hui-mouse.el index 8665bbf595..356b6b23c8 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 19-May-25 at 00:01:18 by Bob Weiner +;; Last-Mod: 24-Jun-25 at 16:38:34 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -173,13 +173,14 @@ Its default value is `smart-scroll-down'. To disable it, set it to (declare-function todotxt-edit-item "ext:todotxt") (declare-function magit-current-section "magit-selection") -(declare-function magit-diff-visit-file "etx:magit-diff") -(declare-function magit-diff-visit-file--internal "etx:magit-diff") -(declare-function magit-file-at-point "etx:magit-git") -(declare-function magit-section-cycle-diffs "etx:magit-diff") -(declare-function magit-section-cycle-global "etx:magit-selection") -(declare-function magit-section-hide "etx:magit-selection") -(declare-function magit-section-show "etx:magit-selection") +(declare-function magit-diff-visit-file "ext:magit-diff") +(declare-function magit-diff-visit-file--internal "ext:magit-diff") +(declare-function magit-diff-visit-worktree-file "ext:magit-diff") +(declare-function magit-file-at-point "ext:magit-git") +(declare-function magit-section-cycle-diffs "ext:magit-diff") +(declare-function magit-section-cycle-global "ext:magit-selection") +(declare-function magit-section-hide "ext:magit-selection") +(declare-function magit-section-show "ext:magit-selection") (defvar magit-root-section) (defvar magit-display-buffer-function) @@ -1567,8 +1568,10 @@ If key is pressed: (2) at the end of a line, scroll up a windowful; (3) in a `magit-status-mode' buffer on a merge conflict marker, keep either the upper, both or the lower version of the conflict. - (4) on an initial read-only header line, cycle visibility of diff sections; - (5) anywhere else, hide/show the thing at point (\"TAB\" key binding) + (4) on a line starting with a `+' char in `magit-status-mode' or + `magit-revision-mode' go to the worktree file. + (5) on an initial read-only header line, cycle visibility of diff sections; + (6) anywhere else, hide/show the thing at point (\"TAB\" key binding) unless that does nothing in the mode, then jump to the thing at point (\"RET\" key binding) but display based on the value of `hpath:display-where'." @@ -1589,7 +1592,13 @@ If key is pressed: ((looking-at (regexp-quote "++=======")) (setq op 'magit-smerge-keep-all))))) (call-interactively op)) - (t + ((and + (memq major-mode '(magit-status-mode magit-revision-mode)) + (save-excursion + (beginning-of-line) + (looking-at-p "\\+"))) + (call-interactively #'magit-diff-visit-worktree-file)) + (t (let ((magit-display-buffer-function #'hpath:display-buffer)) (call-interactively #'smart-magit-tab)))))) diff --git a/man/.dir-locals.el b/man/.dir-locals.el index 7643932b4d..06e82591df 100644 --- a/man/.dir-locals.el +++ b/man/.dir-locals.el @@ -1,19 +1,20 @@ ((texinfo-mode . ((before-save-hook . (lambda () - (let ((day (format-time-string "%d" (current-time))) - (month (capitalize (format-time-string "%B" (current-time)))) - (year (format-time-string "%Y" (current-time)))) - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "\\(@set UPDATED [[:word:]]+, [[:digit:]]+\\)" nil t) - (replace-match (format "@set UPDATED %s, %s" month year) nil t nil nil)) - (goto-char (point-min)) - (when (re-search-forward "\\(@set UPDATED-MONTH [[:word:]]+ [[:digit:]]+\\)" nil t) - (replace-match (format "@set UPDATED-MONTH %s %s" month year) nil t nil nil)) - (goto-char (point-min)) - (when (re-search-forward "\\(Printed [[:word:]]+ [[:digit:]]+, [[:digit:]]+\.\\)" nil t) - (replace-match (format "Printed %s %s, %s." month day year) nil t nil nil)) - (goto-char (point-min)) - (when (re-search-forward "\\([[:word:]]+ [[:digit:]]+, [[:digit:]]+ @c AUTO-REPLACE-ON-SAVE\\)" nil t) - (replace-match (format "%s %s, %s @c AUTO-REPLACE-ON-SAVE" month day year) nil t nil nil))))))))) + (with-locale-environment "en_US.utf8" + (let ((day (format-time-string "%d" (current-time))) + (month (capitalize (format-time-string "%B" (current-time)))) + (year (format-time-string "%Y" (current-time)))) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\\(@set UPDATED [[:word:]]+, [[:digit:]]+\\)" nil t) + (replace-match (format "@set UPDATED %s, %s" month year) nil t nil nil)) + (goto-char (point-min)) + (when (re-search-forward "\\(@set UPDATED-MONTH [[:word:]]+ [[:digit:]]+\\)" nil t) + (replace-match (format "@set UPDATED-MONTH %s %s" month year) nil t nil nil)) + (goto-char (point-min)) + (when (re-search-forward "\\(Printed [[:word:]]+ [[:digit:]]+, [[:digit:]]+\.\\)" nil t) + (replace-match (format "Printed %s %s, %s." month day year) nil t nil nil)) + (goto-char (point-min)) + (when (re-search-forward "\\([[:word:]]+ [[:digit:]]+, [[:digit:]]+ @c AUTO-REPLACE-ON-SAVE\\)" nil t) + (replace-match (format "%s %s, %s @c AUTO-REPLACE-ON-SAVE" month day year) nil t nil nil)))))))))) diff --git a/man/hyperbole.texi b/man/hyperbole.texi index 1edff261c9..d9eb21c09e 100644 --- a/man/hyperbole.texi +++ b/man/hyperbole.texi @@ -7,7 +7,7 @@ @c Author: Bob Weiner @c @c Orig-Date: 6-Nov-91 at 11:18:03 -@c Last-Mod: 21-Jun-25 at 22:30:47 by Bob Weiner +@c Last-Mod: 26-Jun-25 at 18:26:06 by Mats Lidell @c %**start of header (This is for running Texinfo on a region.) @setfilename hyperbole.info @@ -171,7 +171,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P> <PRE> Edition 9.0.2pre -Printed June 21, 2025. +Printed June 26, 2025. Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -213,7 +213,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @example Edition 9.0.2pre -May 19, 2025 +June 26, 2025 @c AUTO-REPLACE-ON-SAVE + Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -10890,8 +10891,10 @@ If pressed within a Magit buffer and not on a button: (3) in a @code{magit-status-mode} buffer on a merge conflict marker, keep either the upper, both or the lower version of the conflict. See also @ref{smerge}. - (4) on an initial read-only header line, cycle visibility of diff sections; - (5) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key binding) + (4) on a line starting with a `+' char in `magit-status-mode' or + `magit-revision-mode' go to the worktree file. + (5) on an initial read-only header line, cycle visibility of diff sections; + (6) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key binding) unless that does nothing in the mode, then jump to the thing at point (@bkbd{@key{RET}} key binding) but display based on the value of @code{hpath:display-where}. diff --git a/test/hui-tests.el b/test/hui-tests.el index 09c1dcd805..5b04cbd065 100644 --- a/test/hui-tests.el +++ b/test/hui-tests.el @@ -1,9 +1,9 @@ -;ui-tests.el --- tests for hui.el Hyperbole UI -*- lexical-binding: t; -*- +;; hui-tests.el --- tests for hui.el Hyperbole UI -*- lexical-binding: t; -*- ;; ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 30-Jan-21 at 12:00:00 -;; Last-Mod: 6-Jul-25 at 13:02:40 by Bob Weiner +;; Last-Mod: 6-Jul-25 at 15:40:32 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1446,6 +1446,86 @@ line 1 (should (string= "abcjkl" (buffer-string))) (should (string= "{def}{ghi}" (car kill-ring)))))) +(ert-deftest hui--select-boundaries () + "Verify `hui-select-boundaries´." + (with-temp-buffer + (let ((hui-select-region (cons nil nil)) + (hui-select-previous 'char) + (hui-select-old-region (cons nil nil))) + (text-mode) + (insert "hi\n") + (goto-char 1) + (should (equal '(1 . 3) (hui-select-boundaries (point)))))) + (with-temp-buffer + (let ((hui-select-region (cons nil nil)) + (hui-select-previous 'char) + (hui-select-old-region (cons nil nil))) + (text-mode) + (insert "hi") + (goto-char 1) + (should (equal '(1 . 1) (hui-select-boundaries (point)))))) + (with-temp-buffer + (let ((hui-select-region (cons nil nil)) + (hui-select-previous 'char) + (hui-select-old-region (cons nil nil))) + (text-mode) + (insert "<hi>\n") + (goto-char 2) + (should (equal '(2 . 4) (hui-select-boundaries (point)))))) + (with-temp-buffer + (let ((hui-select-region (cons nil nil)) + (hui-select-previous 'char) + (hui-select-old-region (cons nil nil))) + (text-mode) + (insert "<hi>\n") + (goto-char 1) + (should (equal '(1 . 5) (hui-select-boundaries (point)))))) + (with-temp-buffer + (let ((hui-select-region (cons nil nil)) + (hui-select-previous 'char) + (hui-select-old-region (cons nil nil))) + (text-mode) + (insert "<hi>") + (goto-char 1) + (should (equal '(1 . 1) (hui-select-boundaries (point))))))) + +(ert-deftest hui--kill-region-delimited-text-and-yank-back () + "Verify multiple `hui:kill-region' followed by a `yank' restores contents." + :expected-result :failed + (with-temp-buffer + (let ((transient-mark-mode t) + (mark-even-if-inactive t) + last-command) + (insert "<hi>") + (goto-char 2) + (setq last-command #'ignore) + (call-interactively #'hui:kill-region) + (should (string= (buffer-string) "<>")) + (yank) + (should (string= (buffer-string) "<hi>")))) + (with-temp-buffer + (let ((transient-mark-mode t) + (mark-even-if-inactive t) + last-command) + (insert "<hi>\n") + (goto-char 1) + (setq last-command #'ignore) + (call-interactively #'hui:kill-region) + (should (string= (buffer-string) "\n")) + (yank) + (should (string= (buffer-string) "<hi>\n")))) + (with-temp-buffer + (let ((transient-mark-mode t) + (mark-even-if-inactive t) + last-command) + (insert "<hi>") + (goto-char 1) + (setq last-command #'ignore) + (call-interactively #'hui:kill-region) + (should (string= (buffer-string) "")) + (yank) + (should (string= (buffer-string) "<hi>"))))) + ;; This file can't be byte-compiled without the `el-mock' which ;; is not part of the actual dependencies, so: ;; Local Variables: diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el index 39f51acc4a..54c5a1f7aa 100644 --- a/test/hy-test-helpers.el +++ b/test/hy-test-helpers.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 30-Jan-21 at 12:00:00 -;; Last-Mod: 6-Jul-25 at 13:06:39 by Bob Weiner +;; Last-Mod: 6-Jul-25 at 15:40:23 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -20,6 +20,7 @@ (require 'ert) (require 'hmouse-drv) ; For `action-key' +(require 'hywiki) ; For `hywiki-word-face-at-p' (eval-when-compile (require 'cl-lib)) (defun hy-test-helpers:consume-input-events () diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index 2c5dfe4a20..ef8299be88 100644 --- a/test/hywiki-tests.el +++ b/test/hywiki-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 18-May-24 at 23:59:48 -;; Last-Mod: 6-Jul-25 at 13:02:40 by Bob Weiner +;; Last-Mod: 6-Jul-25 at 15:39:40 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1672,6 +1672,25 @@ Insert test in the middle of other text." (hy-delete-files-and-buffers (list wikiHi wikiHo)) (hy-delete-dir-and-buffer hywiki-directory))))) +(ert-deftest hywiki-tests--create-wikiword-file-highlights-wikiword () + "Verify creating a WikiWord-file highlights the WikiWord in another file." + (hywiki-tests--preserve-hywiki-mode + (let* ((hywiki-directory (make-temp-file "hywiki" t)) + (wikiHi (cdr (hywiki-add-page "Hi"))) + (hywiki-tests--with-face-test t) + wikiHo) + (unwind-protect + (progn + (hywiki-mode 1) + (with-current-buffer (find-file wikiHi) + (insert "Ho") + (save-buffer) + (setq wikiHo (cdr (hywiki-add-page "Ho"))) + (goto-char 2) + (hywiki-tests--verify-hywiki-word "Ho"))) + (hy-delete-files-and-buffers (list wikiHi wikiHo)) + (hy-delete-dir-and-buffer hywiki-directory))))) + (provide 'hywiki-tests) ;; This file can't be byte-compiled without the `el-mock' package