branch: externals/hyperbole commit 3fb117307550b25b724cbc51f04e3314523c0d72 Merge: 64ce04dc4a 4314e8c246 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Merge branch 'master' into rsw --- .github/workflows/main.yml | 1 + ChangeLog | 15 +++++++++++++++ Makefile | 4 ++-- hact.el | 4 ++-- hargs.el | 5 +++-- test/MANIFEST | 1 + test/hact-tests.el | 38 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e04c136698..74b5ee61bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,7 @@ jobs: run: make clean - name: Compile + shell: bash run: | make bin 2>&1 | tee MAKE_BIN_OUTPUT echo "Number of warnings: $(grep "Warning:" MAKE_BIN_OUTPUT | wc -l)" >> $GITHUB_STEP_SUMMARY diff --git a/ChangeLog b/ChangeLog index 859b025468..f3bc6ce513 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,21 @@ (hywiki-initialize-mode-map): Add and make punct. and non-square-bracket and non-angle-bracket balanced expressions highlight HyWiki page name references. +2024-05-18 Mats Lidell <ma...@gnu.org> + +* hargs.el (hargs:action-get): Add Emacs 30 closure support. + +2024-05-17 Mats Lidell <ma...@gnu.org> + +* Makefile (dockerized): Add quotes so make is executed in the container. + +2024-05-16 Mats Lidell <ma...@gnu.org> + +* test/hact-tests.el (hact-tests--action-params-with-lambdas) + (hact-tests--actype-act-with-lambdas): Verify closures. + +* hact.el (actype:act): Add Emacs 30 closure support. + 2024-05-15 Bob Weiner <r...@gnu.org> * hywiki.el (org-mode-hook): Remove 'post-self-insert-hook' and instead highlight diff --git a/Makefile b/Makefile index 8a0a4fd8e6..63622e1515 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Author: Bob Weiner # # Orig-Date: 15-Jun-94 at 03:42:38 -# Last-Mod: 22-Apr-24 at 02:10:20 by Bob Weiner +# Last-Mod: 18-May-24 at 20:24:41 by Bob Weiner # # Copyright (C) 1994-2023 Free Software Foundation, Inc. # See the file HY-COPY for license information. @@ -562,7 +562,7 @@ DOCKER_VERSION = master-ci endif dockerized: - docker run -v $$(pwd):/hyperbole -it silex/emacs:${DOCKER_VERSION} bash -c cd hyperbole && make ${DOCKER_TARGETS} + docker run -v $$(pwd):/hyperbole -it silex/emacs:${DOCKER_VERSION} bash -c "make -C hyperbole ${DOCKER_TARGETS}" # Run with coverage. Run tests given by testspec and monitor the # coverage for the specified file. diff --git a/hact.el b/hact.el index 28ba545c81..18107e2af5 100644 --- a/hact.el +++ b/hact.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 18-Sep-91 at 02:57:09 -;; Last-Mod: 12-May-24 at 22:02:42 by Bob Weiner +;; Last-Mod: 18-May-24 at 20:26:19 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -414,7 +414,7 @@ performing ACTION." (let ((hist-elt (hhist:element))) (run-hooks 'action-act-hook) (prog1 (or (when (and (fboundp #'closurep) (closurep action)) - (funcall action args)) + (apply action args)) (if (or (symbolp action) (listp action) (byte-code-function-p action) (subrp action) diff --git a/hargs.el b/hargs.el index e5367f00b8..319c4e5c7d 100644 --- a/hargs.el +++ b/hargs.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 31-Oct-91 at 23:17:35 -;; Last-Mod: 20-Jan-24 at 19:43:53 by Mats Lidell +;; Last-Mod: 18-May-24 at 16:07:11 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -100,7 +100,8 @@ Current button is being edited when EDITING-FLAG is t. Return nil if ACTION is not a list or `byte-code' object, has no interactive form or takes no arguments." (save-excursion - (and (or (subrp action) (byte-code-function-p action) (listp action)) + (and (or (subrp action) (byte-code-function-p action) (listp action) + (and (fboundp #'closurep) (closurep action))) (let ((interactive-form (action:commandp action))) (when interactive-form (hpath:relative-arguments diff --git a/test/MANIFEST b/test/MANIFEST index 0eb68c930e..85d9f695dc 100644 --- a/test/MANIFEST +++ b/test/MANIFEST @@ -1,5 +1,6 @@ --- HYPERBOLE TEST CASES --- demo-tests.el - unit tests from examples in the DEMO +hact-tests.el - hact unit tests hactypes-tests.el - Ert tests for hactypes hargs-tests.el - hargs unit tests hbut-tests.el - hbut unit tests diff --git a/test/hact-tests.el b/test/hact-tests.el new file mode 100644 index 0000000000..00c37b1e0c --- /dev/null +++ b/test/hact-tests.el @@ -0,0 +1,38 @@ +;;; hact-tests.el --- unit tests for hact -*- lexical-binding: t; -*- +;; +;; Author: Mats Lidell +;; +;; Orig-Date: 16-May-24 at 00:29:22 +;; Last-Mod: 16-May-24 at 23:51:18 by Mats Lidell +;; +;; SPDX-License-Identifier: GPL-3.0-or-later +;; +;; Copyright (C) 2021-2022 Free Software Foundation, Inc. +;; See the "HY-COPY" file for license information. +;; +;; This file is part of GNU Hyperbole. + +;;; Commentary: +;; + +;;; Code: + +(require 'ert) +(require 'hact) + +(ert-deftest hact-tests--action-params-with-lambdas () + "Lambda used with `action:params' should return the lambda parameters." + (should (equal nil (action:params (lambda () nil)))) + (should (equal '(x) (action:params (lambda (x) nil)))) + (should (equal '(x y) (action:params (lambda (x y) nil))))) + +(ert-deftest hact-tests--actype-act-with-lambdas () + "Lambda with `actype:act' should work over versions of Emacs. +Covers backwards incompatible change in Emacs 30." + (should (= 2 (actype:act (lambda () 2)))) + (should (= 2 (actype:act (lambda (x) x) 2))) + (should (= 2 (actype:act (lambda (x) (1+ x)) 1))) + (should (= 2 (actype:act (lambda (x y) (+ x y)) 1 1)))) + +(provide 'hact-tests) +;;; hact-tests.el ends here