branch: externals/hyperbole commit f89d3b46775c2b3de32f04c96bff17aeaec3ea39 Merge: bcc6ebd031 9ee1f8ea12 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Merge branch 'master' into rsw --- ChangeLog | 41 +++++++++++++++++++++++++++++- Makefile | 4 +-- hact.el | 6 ++--- hargs.el | 4 +-- hasht.el | 11 ++++++-- hsys-consult.el | 15 +++++++++-- hui-mouse.el | 8 +++--- test/hibtypes-tests.el | 34 ++++++++++++++++++++++--- test/hpath-tests.el | 23 ++++++++++++++++- test/hsys-org-tests.el | 69 +++++++++++++++++++++++++++++++++++++++++++++++++- test/hui-tests.el | 9 ++++++- test/hywiki-tests.el | 21 +++++++++++++-- 12 files changed, 220 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c093c48ef..74c232414e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,12 +24,46 @@ (hsys-org--agenda-tags-string): Improve doc string and fix to return non-nil only when point is within a tag string. Simplify return value creation. +2024-07-28 Mats Lidell <ma...@gnu.org> + +* test/hibtypes-tests.el (ibtypes:org-id-test): Test org-id ibut. + +2024-07-27 Mats Lidell <ma...@gnu.org> + +* test/hsys-org-tests.el (hsys-org--get-agenda-tags): Test + hsys-org-get-agenda-tags. + +2024-07-26 Mats Lidell <ma...@gnu.org> + +* hsys-org.el (hsys-org--agenda-tags-string): Update docstring. + +* test/hsys-org-tests.el (hsys-org--mode-p): Test hsys-org-mode-p. + (hsys-org---agenda-tags-string): Test hsys-org--agenda-tags-string. + +* test/hywiki-tests.el (hywiki-tests--at-tags-p): Test hywiki-at-tags-p. + +* test/hsys-org-tests.el (hsys-org--directory-at-tags-p): Test + hsys-org-directory-at-tags-p. + 2024-07-15 Bob Weiner <r...@gnu.org> * hywiki.el (hywiki-in-page-p): Change to use 'default-directory' instead of 'buffer-file-name' so works with temp buffers created during Org export to other formats, e.g. html. +2024-07-15 Mats Lidell <ma...@gnu.org> + +* test/hsys-org-tests.el (hsys-org--at-tags-p): Test hsys-org-at-tags-p. + +* test/hpath-tests.el (hpath--to-markup-anchor): Test hpath:to-markup-anchor. + +* test/hui-tests.el (hui--link-possible-types): Add test for single-line + region. + +2024-07-14 Mats Lidell <ma...@gnu.org> + +* Makefile (DOCKER_VERSIONS): Use 29.4 for local docker builds. + 2024-07-14 Bob Weiner <r...@gnu.org> * hywiki.el (hywiki-convert-words-to-org-links, hywiki-map-words): Add. @@ -48,6 +82,11 @@ (hywiki-buttonize-word): Add. (hywiki-maybe-highlight-page-name): Rewrite to use above function. +2024-07-12 Mats Lidell <ma...@gnu.org> + +* test/hywiki-tests.el (hywiki-tests--maybe-at-wikiword-beginning): Fix + set of acceptable chars and use escaped notation. + 2024-07-10 Bob Weiner <r...@gnu.org> * hywiki.el (hywiki-org-link-export): Add as [[hy:WikiWord]] link-export property. @@ -248,7 +287,7 @@ (hynote-file): Add ibtype to display non-HyWikiWord files in hywiki-directory'. -* Makefile: (docker-run): Add to intweractively run docker versions +* Makefile: (docker-run): Add to interactively run docker versions of Emacs with Hyperbole. Update Commentary to summarize docker targets that build, byte-compile and run Hyperbole. diff --git a/Makefile b/Makefile index c9a9e405c5..1bd33371a2 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Author: Bob Weiner # # Orig-Date: 15-Jun-94 at 03:42:38 -# Last-Mod: 7-Jul-24 at 22:21:42 by Mats Lidell +# Last-Mod: 9-Jul-24 at 09:06:21 by Mats Lidell # # Copyright (C) 1994-2023 Free Software Foundation, Inc. # See the file HY-COPY for license information. @@ -176,7 +176,7 @@ ELISP_TO_COMPILE = $(pkg_parent)/elc-${USER} HYPB_WEB_REPO_LOCATION = "../hyweb/hyperbole/" # CI/CD Emacs versions for local docker based tests -DOCKER_VERSIONS=27.2 28.2 29.3 master +DOCKER_VERSIONS=27.2 28.2 29.4 master ########################################################################## # NO CHANGES REQUIRED BELOW HERE. # diff --git a/hact.el b/hact.el index 553c0d4366..073a35a581 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: 22-Jun-24 at 22:50:10 by Mats Lidell +;; Last-Mod: 12-Jul-24 at 23:32:57 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -368,7 +368,7 @@ Autoloads action function if need be to get the parameter list." (action:params-emacs action))) ((symbolp action) (car (cdr (and (fboundp action) (hypb:indirect-function action))))) - ((and (fboundp #'closurep) (closurep action)) + ((and (fboundp 'closurep) (closurep action)) (aref action 0)))) (defun action:param-list (action) @@ -414,7 +414,7 @@ performing ACTION." (setq args (hpath:absolute-arguments actype args))) (let ((hist-elt (hhist:element))) (run-hooks 'action-act-hook) - (prog1 (or (when (and (fboundp #'closurep) (closurep action)) + (prog1 (or (when (and (fboundp 'closurep) (closurep action)) (apply action args)) (if (or (symbolp action) (listp action) (byte-code-function-p action) diff --git a/hargs.el b/hargs.el index 58a39c4ff6..32f6c24186 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: 22-Jun-24 at 22:53:41 by Mats Lidell +;; Last-Mod: 12-Jul-24 at 23:33:16 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -102,7 +102,7 @@ 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 (fboundp #'closurep) (closurep action))) + (and (fboundp 'closurep) (closurep action))) (let ((interactive-form (action:commandp action))) (when interactive-form (hpath:relative-arguments diff --git a/hasht.el b/hasht.el index 0e3706edc5..4589659d32 100644 --- a/hasht.el +++ b/hasht.el @@ -8,7 +8,7 @@ ;; AUTHOR: Bob Weiner ;; ;; ORIG-DATE: 16-Mar-90 at 03:38:48 -;; LAST-MOD: 30-Jun-24 at 17:39:31 by Bob Weiner +;; LAST-MOD: 12-Jul-24 at 23:22:26 by Mats Lidell ;; ;; Copyright (C) 1990-1995, 1997, 2016 Free Software Foundation, Inc. ;; See the file BR-COPY for license information. @@ -53,6 +53,12 @@ "*Hash-merge function to merge values from 2 hash tables with the same key. It is sent the two values as arguments.") +;;; ************************************************************************ +;;; Public declarations +;;; ************************************************************************ + +(defvar hash-empty-htable) + ;;; ************************************************************************ ;;; Public functions ;;; ************************************************************************ @@ -66,7 +72,8 @@ Replaces any VALUE previously referenced by KEY." (if sym (set sym value))))) (defun hash-copy (hash-table) - "Return a copy of HASH-TABLE, list and vector elements are shared across both tables." + "Return a copy of HASH-TABLE. +List and vector elements are shared across both tables." (if (not (hashp hash-table)) (error "(hash-copy): Invalid hash-table: `%s'" hash-table)) (let ((htable-copy (hash-make (length (hash-obarray hash-table))))) diff --git a/hsys-consult.el b/hsys-consult.el index 8310773ec0..275fb1e7d2 100644 --- a/hsys-consult.el +++ b/hsys-consult.el @@ -2,7 +2,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 4-Jul-24 at 09:57:18 -;; Last-Mod: 7-Jul-24 at 21:58:54 by Bob Weiner +;; Last-Mod: 12-Jul-24 at 22:05:30 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -27,10 +27,21 @@ ;; Don't (require 'consult) here since want to create that dependency only ;; when a function within this library is called. +(require 'hbut) +(require 'hargs) +(require 'hproperty) +(require 'hsys-org-roam) +(require 'find-func) + ;;; ************************************************************************ ;;; Public declarations ;;; ************************************************************************ +(declare-function hyrolo-at-tags-p "hyrolo") +(declare-function hywiki-at-tags-p "hywiki") +(declare-function hsys-org-directory-at-tags-p "hsys-org") +(declare-function hsys-org-at-tags-p "hsys-org") + (declare-function consult-grep "ext:consult") (declare-function consult-ripgrep "ext:consult") (declare-function org-roam-db-autosync-mode "ext:org-roam") @@ -199,7 +210,7 @@ that start with the '^[*#]+[ \t]*' regexp)." "Interactively search PATHS with a consult package grep command. Use ripgrep (rg) if found, otherwise, plain grep. Interactively show all matches from PATHS; see the documentation for the `dir' -argument in `consult-grep' for valid values of PATHS. +argument in `consult-grep' for valid values of PATHS. Initialize search with optional REGEXP and interactively prompt for changes. Limit matches per file to the absolute value of diff --git a/hui-mouse.el b/hui-mouse.el index 8bfafaa794..e7ce7e5ccc 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 6-Jul-24 at 00:38:17 by Bob Weiner +;; Last-Mod: 12-Jul-24 at 20:48:37 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1814,7 +1814,7 @@ When the Action Key is pressed and `hsys-org-enable-smart-keys' is t: 3. On an Org agenda view item, jump to the item for editing. When the Action Key is pressed and `hsys-org-enable-smart-keys' is -either t or 'buttons: +either t or \\='buttons: 4. Within a radio or internal target or a link to it, jump between the target and the first link to it, allowing two-way navigation. @@ -1830,13 +1830,13 @@ either t or 'buttons: 9. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example or #+end_example header, execute the code block via the Org mode - standard binding of {\\`C-c' \\`C-c'}, (org-ctrl-c-ctrl-c). + standard binding of {\\`C-c' \\`C-c'}, (`org-ctrl-c-ctrl-c'). 10. With point on an Org mode heading, cycle the view of the subtree at point. 11. In any other context besides the end of a line, invoke the Org mode - standard binding of {M-RET}, (org-meta-return). + standard binding of {M-RET}, (`org-meta-return'). When the Assist Key is pressed, it behaves just like the Action Key except in these contexts: diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index eddd39d0a6..ce9a72665d 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 20-Feb-21 at 23:45:00 -;; Last-Mod: 16-Jun-24 at 18:45:13 by Mats Lidell +;; Last-Mod: 28-Jul-24 at 00:33:04 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -19,7 +19,7 @@ ;;; Code: (require 'ert) -(require 'hib-kbd) +(require 'hibtypes) (require 'info) (require 'el-mock) (require 'hy-test-helpers "test/hy-test-helpers") @@ -27,8 +27,6 @@ (declare-function hy-test-helpers:consume-input-events "hy-test-helpers") (declare-function hy-test-helpers:should-last-message "hy-test-helpers") -;; (ert-deftest org-link-outside-org-mode-test () - ;; Mail address (ert-deftest mail-address-at-p-test () (with-temp-buffer @@ -331,6 +329,34 @@ ;; completion +(ert-deftest ibtypes:org-id-test () + "Verify `org-id' ibut." + (with-temp-buffer + (org-mode) + (insert (format ":ID: %s" (hypb:uuid))) + (goto-char 10) + (should (string= + "On ID definition; use {C-u M-RET} to copy a link to an ID." + (ibtypes::org-id)))) + + (let ((file (make-temp-file "hypb" nil ".org"))) + (unwind-protect + (let ((id (hypb:uuid))) + (find-file file) + (org-mode) + (insert (format "* header +:PROPERTIES: +:ID: %s +:END: + +<ID:%s> +" id id)) + (goto-char (point-min)) + (should (and (search-forward "<ID:") (looking-at-p id))) + (mocklet (((actypes::link-to-org-id-marker *) => t)) + (should (ibtypes::org-id)))) + (hy-delete-file-and-buffer file)))) + ;; This file can't be byte-compiled without the `el-mock' package (because of ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole. ;; Local Variables: diff --git a/test/hpath-tests.el b/test/hpath-tests.el index 413d755928..b8fb6753f3 100644 --- a/test/hpath-tests.el +++ b/test/hpath-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 28-Feb-21 at 23:26:00 -;; Last-Mod: 1-Jun-24 at 20:45:10 by Mats Lidell +;; Last-Mod: 15-Jul-24 at 00:07:11 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -442,6 +442,27 @@ dir/subdir: (should (string= (expand-file-name (concat filename ".ext") "dir/subdir") (hpath:delimited-possible-path)))))))))) +(ert-deftest hpath--to-markup-anchor () + "Verify `hpath:to-markup-anchor'." + (dolist (v '((text-mode 2) (outline-mode 0))) + (with-temp-buffer + (funcall (car v)) ;; Mode + (insert "Line 1\n* anchor\n* anchor") + (goto-char 4) + (hpath:to-markup-anchor nil "anchor") + (should (= (line-number-at-pos) 2)) + (should (= (current-column) (cadr v))) + + (goto-char 4) + (hpath:to-markup-anchor nil "anchor" 2) + (should (= (line-number-at-pos) 3)) + (should (= (current-column) (cadr v))) + + (goto-char 4) + (hpath:to-markup-anchor t nil) + (should (= (line-number-at-pos) 1)) + (should (= (current-column) 0))))) + (provide 'hpath-tests) :; This file can't be byte-compiled without the `el-mock' package diff --git a/test/hsys-org-tests.el b/test/hsys-org-tests.el index 2c7258d58b..62c647267c 100644 --- a/test/hsys-org-tests.el +++ b/test/hsys-org-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 23-Apr-21 at 20:55:00 -;; Last-Mod: 29-Jun-24 at 15:13:29 by Bob Weiner +;; Last-Mod: 28-Jul-24 at 11:44:20 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -20,6 +20,7 @@ (require 'ert) (require 'hsys-org) +(require 'org-agenda) (if t (require 'el-mock)) (ert-deftest hsys-org:cycle-on-header-cycles-visibility () @@ -158,6 +159,72 @@ This is independent of the setting of `hsys-org-enable-smart-keys'." (should (action-key)))))) (hy-delete-file-and-buffer file)))) +(ert-deftest hsys-org--at-tags-p () + "Verify `hsys-org-at-tags-p'." + (with-temp-buffer + (org-mode) + (save-excursion (insert "* header :tag:")) + (font-lock-ensure) + (should-not (hsys-org-at-tags-p)) + (should (search-forward ":")) + (should (hsys-org-at-tags-p)))) + +(ert-deftest hsys-org--directory-at-tags-p () + "Verify `hsys-org-directory-at-tags-p'." + (mocklet ((hsys-org-at-tags-p => nil) + (string-prefix-p not-called)) + (should-not (hsys-org-directory-at-tags-p))) + (let ((buffer-file-name (expand-file-name "buff" org-directory))) + (mocklet ((hsys-org-at-tags-p not-called)) + (should (hsys-org-directory-at-tags-p t)))) + (mocklet ((hsys-org-at-tags-p => t)) + (let ((buffer-file-name (expand-file-name "buff" org-directory))) + (should (hsys-org-directory-at-tags-p)))) + (mocklet ((hsys-org-at-tags-p => t) + (buffer-name => "*Org Agenda*")) + (let ((buffer-file-name nil)) + (should (hsys-org-directory-at-tags-p)))) + (mocklet ((hsys-org-at-tags-p => t) + (buffer-name => "*Another Agenda*")) + (let ((buffer-file-name nil)) + (should-not (hsys-org-directory-at-tags-p))))) + +(ert-deftest hsys-org--mode-p () + "Verify `hsys-org-mode-p' identifies an org major or minor-mode." + (with-temp-buffer + (org-mode) + (should (hsys-org-mode-p)) + (org-agenda-mode) + (should (hsys-org-mode-p)))) + +(ert-deftest hsys-org---agenda-tags-string () + "Verify `hsys-org--agenda-tags-string'." + (with-temp-buffer + (org-mode) + (save-excursion (insert "* header :tag1:tag2:tag3:")) + (font-lock-ensure) + + (should (and (search-forward "header ") (looking-at-p ":tag1:"))) + (should (string= ":tag1:tag2:tag3" (hsys-org--agenda-tags-string))) + + (forward-char) + (should (looking-at-p "tag1:")) + (should (string= ":tag1" (hsys-org--agenda-tags-string))) + + (should (and (search-forward "tag1") (looking-at-p ":tag2:"))) + (should (string= ":tag1:tag2:tag3" (hsys-org--agenda-tags-string))) + + (forward-char) + (should (looking-at-p "tag2:")) + (should (string= ":tag2" (hsys-org--agenda-tags-string))))) + +(ert-deftest hsys-org--get-agenda-tags () + "Verify `hsys-org-get-agenda-tags' calls org-consult-agenda-function." + (mocklet ((agenda-func => "agenda-func") + (hsys-org-at-tags-p => t) + (hsys-org--agenda-tags-string => ":tag")) + (should (string= "agenda-func" (hsys-org-get-agenda-tags #'agenda-func))))) + (provide 'hsys-org-tests) ;; This file can't be byte-compiled without the `el-mock' package diff --git a/test/hui-tests.el b/test/hui-tests.el index 6c5d11fa0d..27de42def6 100644 --- a/test/hui-tests.el +++ b/test/hui-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 30-Jan-21 at 12:00:00 -;; Last-Mod: 31-May-24 at 15:58:58 by Mats Lidell +;; Last-Mod: 13-Jul-24 at 23:42:26 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1113,6 +1113,13 @@ With point on label suggest that ibut for rename." (hy-test-helpers:ensure-link-possible-type 'link-to-kcell)) (hy-delete-file-and-buffer file))) + ;; Single-line Region link-to-string-match + (with-temp-buffer + (insert "a word") + (goto-char 4) + (mark-word) + (hy-test-helpers:ensure-link-possible-type 'link-to-string-match)) + ;; Outline Heading link-to-string-match (let ((file (make-temp-file "hypb" nil ".otl" "* heading\nbody\n"))) (unwind-protect diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index 99f3c01dda..c4fa52ff2e 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: 22-Jun-24 at 18:56:31 by Mats Lidell +;; Last-Mod: 26-Jul-24 at 20:01:49 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -111,7 +111,7 @@ (should (hywiki-maybe-at-wikiword-beginning)) (goto-char 2) (should-not (hywiki-maybe-at-wikiword-beginning))) - (dolist (acceptable-char '("(" "{" "<" "\"" "'" "`" " " " " " " "" " ")) + (dolist (acceptable-char '("(" "{" "<" "\"" "'" "`" "\t" "\n" "\r" "\f" " ")) (with-temp-buffer (insert (format "%sWikiWord" acceptable-char)) (goto-char 2) @@ -251,5 +251,22 @@ (should-not (hproperty:but-get (point) 'face hywiki-word-face)))) (hy-delete-dir-and-buffer hywiki-directory)))) +(ert-deftest hywiki-tests--at-tags-p () + "Verify `hywiki-at-tags-p'." + (mocklet ((hsys-org-at-tags-p => nil)) + (should-not (hywiki-at-tags-p))) + (mocklet ((hsys-org-at-tags-p not-called) + (hywiki-in-page-p => nil)) + (should-not (hywiki-at-tags-p t))) + (mocklet ((hsys-org-at-tags-p => t) + (hywiki-in-page-p => t)) + (should (hywiki-at-tags-p))) + (mocklet ((hsys-org-at-tags-p => t) + (hywiki-in-page-p => nil)) + (mocklet ((buffer-name => "*HyWiki Tags*")) + (should (hywiki-at-tags-p))) + (mocklet ((buffer-name => "*Other Tags*")) + (should-not (hywiki-at-tags-p))))) + (provide 'hywiki-tests) ;;; hywiki-tests.el ends here