branch: externals/hyperbole commit 40611fa03b9d4bf54f2ce9e874249e9cf1e539cb Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Fix som complex path, key series and windows grid resolutions --- ChangeLog | 28 ++++++++++++++++++++++++++++ FAST-DEMO | 4 ++-- hbut.el | 13 +++++++++++-- hib-kbd.el | 10 ++++++---- hpath.el | 35 ++++++++++++++++++++++++++++++----- hui-select.el | 10 +++++----- hycontrol.el | 8 +++++--- hyrolo.el | 6 +++--- test/hmouse-drv-tests.el | 12 ++++-------- test/hpath-tests.el | 10 +++------- 10 files changed, 97 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecaa36966b..0e8d30ffb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2022-05-16 Bob Weiner <r...@gnu.org> + +* FAST-DEMO: Change from /usr/bin/bash to /bin/bash. + +* hycontrol.el (hycontrol-windows-grid-by-file-pattern): Fix improper relative path + resolution when called interactively; force use of full paths. + +2022-05-15 Bob Weiner <r...@gnu.org> + +* hycontrol.el (hycontrol-windows-grid-by-file-pattern): Fix interactive pattern + to prompt for a string, not a file. + +* hpath.el (hpath:resolve): Add to resolve path variables without doing a path expand. + (hpath:find, hpath:call): Resolve but never expand paths with modifier char + [-!&] as first char since these might need to be searched in exec-directory, not + the current path. + test/hpath-tests.el (hpath:load-modifier-with-plain-file-loads-file-from-load-path): + test/hmouse-drv-tests.el (hbut-load-modifier-with-plain-file-loads-file-from-load-path): + Update to handle non-expansion of relative Lisp library files. + +* hui-select.el (hui-select-initialize): + hib-kbd.el (kbd-key): Fix close bracket syntax to match open (was close). + +* hbut.el (ebut:label-p): Fix handling when point is on final RET and + have nested lists as in here with braces: + { M-x shell RET M-> (pushd ${hyperb:dir}) RET } + by adding a (forward-list) call in the first 'while' construct. + 2022-05-14 Bob Weiner <r...@gnu.org> * hsys-org.el (hsys-org-todo-occur): Add. diff --git a/FAST-DEMO b/FAST-DEMO index b30c0e524a..1fa2d5b38c 100644 --- a/FAST-DEMO +++ b/FAST-DEMO @@ -176,9 +176,9 @@ with bash. If you are using another shell you can for this part switch to bash, - { M-x set-variable RET shell-file-name RET "/usr/bin/bash" RET } + { M-x set-variable RET shell-file-name RET C-u M-! which SPC bash RET RET } - Set the name of the inferior shell to /usr/bin/bash. If you do this + Set the name of the inferior shell to /bin/bash. If you do this don't forget to reset it to your preferred shell when you are ready with the demo. diff --git a/hbut.el b/hbut.el index a475fb5848..849870d2db 100644 --- a/hbut.el +++ b/hbut.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 18-Sep-91 at 02:57:09 -;; Last-Mod: 24-Apr-22 at 11:01:49 by Bob Weiner +;; Last-Mod: 15-May-22 at 23:07:36 by Bob Weiner ;; ;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -232,7 +232,16 @@ to two lines." (re-search-forward (concat quoted start-regexp) npoint t)) (setq start t)) start) - (< (point) opoint) + ;; Handle expressions like: + ;; { M-x shell RET M-> (pushd ${hyperb:dir}) RET } + (save-excursion + (when (eq ?\( (char-syntax (preceding-char))) + (condition-case () + (progn + (forward-char -1) + (forward-list)) + (error nil))) + (< (point) opoint)) (re-search-forward (concat "[^\\{]" end-regexp) opoint t)) (setq start nil)) (when start diff --git a/hib-kbd.el b/hib-kbd.el index 5da56e163e..7fe9a3dd97 100644 --- a/hib-kbd.el +++ b/hib-kbd.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 22-Nov-91 at 01:37:57 -;; Last-Mod: 24-Apr-22 at 17:34:04 by Bob Weiner +;; Last-Mod: 15-May-22 at 22:26:22 by Bob Weiner ;; ;; Copyright (C) 1991-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -97,13 +97,15 @@ Any key sequence within the series must be a string of one of the following: (let ((open-brace-syntax (hypb:get-raw-syntax-descriptor ?\{)) (close-brace-syntax (hypb:get-raw-syntax-descriptor ?\}))) (unwind-protect - (progn (modify-syntax-entry ?\{ "(\}" (syntax-table)) - (modify-syntax-entry ?\} ")\}" (syntax-table)) + (progn (modify-syntax-entry ?\{ "(}" (syntax-table)) + (modify-syntax-entry ?\} "){" (syntax-table)) ;; Handle long series, e.g. eval-elisp actions (let* ((hbut:max-len (max 3000 (hbut:max-len))) - (seq-and-pos (or ;; (kbd) calls but only if point is between double quotes + (seq-and-pos (or + ;; (kbd) calls but only if point is between double quotes (and (hbut:label-p t "(kbd \"" "\"\)" t) (hbut:label-p t "\"" "\"\)" t)) + ;; braces delimiters (hbut:label-p t "{`" "'}" t) (hbut:label-p t "{" "}" t) ;; Regular dual single quotes (Texinfo smart quotes) diff --git a/hpath.el b/hpath.el index 9d25e6361a..7c16178075 100644 --- a/hpath.el +++ b/hpath.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 1-Nov-91 at 00:44:23 -;; Last-Mod: 14-May-22 at 13:53:16 by Bob Weiner +;; Last-Mod: 15-May-22 at 23:36:25 by Bob Weiner ;; ;; Copyright (C) 1991-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -947,7 +947,9 @@ Make any existing path within a file buffer absolute before returning." (if (or (null path) (string-empty-p path)) (setq expanded-path "" path "") - (setq expanded-path (hpath:expand path) + ;; Never expand paths with a prefix character, e.g. program + ;; names which need to use exec-directory expansion. + (setq expanded-path (if prefix (hpath:resolve path) (hpath:expand path)) path (funcall func expanded-path non-exist))) ;; ;; If path is just a local reference that begins with #, @@ -1106,6 +1108,26 @@ window in which the buffer is displayed." "Return the function to display a Hyperbole path using optional symbol DISPLAY-WHERE or `hpath:display-where'." (hpath:display-where-function display-where hpath:display-where-alist)) +(defun hpath:resolve (path) + "Resolve any variable in PATH or prepend any path variable from the first PATH matching regexp in `hpath:auto-variable-alist'. +Return any absolute or invalid PATH unchanged." + (when (stringp path) + (unless (string-match-p hpath:variable-regexp path) + (setq path (substitute-in-file-name path))) + (let (variable-path + substituted-path) + (setq variable-path (hpath:expand-with-variable path) + substituted-path (hpath:substitute-value variable-path)) + (cond ((or (null substituted-path) (string-empty-p substituted-path)) + path) + ((and (string-match-p hpath:variable-regexp variable-path) + (string-match-p hpath:variable-regexp substituted-path)) + ;; If a path is invalid, then a variable may have been prepended but + ;; it will remain unresolved in `substituted-path', in which case we + ;; want to return `path' without any further changes. + path) + (t substituted-path))))) + (defun hpath:expand (path) "Expand relative PATH using the path variable from the first file matching regexp in `hpath:auto-variable-alist'. Return any absolute or invalid PATH unchanged." @@ -1249,7 +1271,7 @@ If FILENAME does not start with a prefix character: location of the link anchor; if it matches a regular expression in the alist returned by - \(hpath:get-external-display-alist), invoke the associated external + (hpath:get-external-display-alist), invoke the associated external display program if not, consult `hpath:internal-display-alist' for a specialized internal @@ -1295,8 +1317,11 @@ buffer but don't display it." (if (string-empty-p path) (setq path "" filename "") - (setq path (hpath:expand path) - filename (hpath:absolute-to path default-directory))) + ;; Never expand filenames with modifier prepended. + (if modifier + (setq path (hpath:resolve path)) + (setq path (hpath:expand path) + filename (hpath:absolute-to path default-directory)))) (let ((remote-filename (hpath:remote-p path))) (or modifier remote-filename (file-exists-p filename) diff --git a/hui-select.el b/hui-select.el index 4b56f4958e..75f4254d18 100644 --- a/hui-select.el +++ b/hui-select.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Oct-96 at 02:25:27 -;; Last-Mod: 8-May-22 at 11:06:42 by Bob Weiner +;; Last-Mod: 15-May-22 at 22:30:57 by Bob Weiner ;; ;; Copyright (C) 1996-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -350,8 +350,8 @@ Also, add language-specific syntax setups to aid in thing selection." ;; Allow for marking and moving brace delimited groups. (var:add-and-run-hook 'lisp-mode-hook (lambda () - (modify-syntax-entry ?\{ "\(\}" lisp-mode-syntax-table) - (modify-syntax-entry ?\} "\)\{" lisp-mode-syntax-table))) + (modify-syntax-entry ?\{ "(}" lisp-mode-syntax-table) + (modify-syntax-entry ?\} "){" lisp-mode-syntax-table))) ;; ;; This hook makes tags, comments, sentences and text blocks ;; selectable in SGML-related modes. @@ -368,8 +368,8 @@ Also, add language-specific syntax setups to aid in thing selection." `(lambda () (let ((syntax-table (symbol-value ',syntax-table-sym)) (keymap (symbol-value ',keymap-sym))) - (modify-syntax-entry ?< "(>" syntax-table) - (modify-syntax-entry ?> ")<" syntax-table) + (modify-syntax-entry ?\< "(>" syntax-table) + (modify-syntax-entry ?\> ")<" syntax-table) (modify-syntax-entry ?\{ "(}" syntax-table) (modify-syntax-entry ?\} "){" syntax-table) (modify-syntax-entry ?\" "\"" syntax-table) diff --git a/hycontrol.el b/hycontrol.el index aa6ee26915..d817c8f17e 100644 --- a/hycontrol.el +++ b/hycontrol.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 1-Jun-16 at 15:35:36 -;; Last-Mod: 27-Feb-22 at 01:11:05 by Bob Weiner +;; Last-Mod: 16-May-22 at 00:12:56 by Bob Weiner ;; ;; Copyright (C) 2016-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -1591,8 +1591,10 @@ the second, number of columns of windows." ;;;###autoload (defun hycontrol-windows-grid-by-file-pattern (pattern &optional full) "Display an automatically sized window grid showing files found from glob PATTERN. -Use absolute file paths if optional FULL is non-nil." - (interactive "FPattern of files to display in windows grid: \nP") +Use absolute file paths if called interactively or optional FULL is non-nil." + (interactive + (list (read-string "Pattern of files to display in windows grid: ") + t)) (let* ((find-file-wildcards t) (files (file-expand-wildcards pattern full))) (hycontrol-windows-grid-by-file-list files))) diff --git a/hyrolo.el b/hyrolo.el index e0b768bd33..ffedaef15c 100644 --- a/hyrolo.el +++ b/hyrolo.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 7-Jun-89 at 22:08:29 -;; Last-Mod: 10-Apr-22 at 23:46:44 by Bob Weiner +;; Last-Mod: 15-May-22 at 22:28:48 by Bob Weiner ;; ;; Copyright (C) 1991-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -1576,8 +1576,8 @@ String search expressions are converted to regular expressions.") () (setq hyrolo-mode-syntax-table (make-syntax-table text-mode-syntax-table)) ;; Support syntactic selection of delimited e-mail addresses. - (modify-syntax-entry ?\< "\(\>" hyrolo-mode-syntax-table) - (modify-syntax-entry ?\> "\)\<" hyrolo-mode-syntax-table)) + (modify-syntax-entry ?\< "(>" hyrolo-mode-syntax-table) + (modify-syntax-entry ?\> ")<" hyrolo-mode-syntax-table)) (defvar hyrolo-mode-map nil "Keymap for the rolo match buffer.") diff --git a/test/hmouse-drv-tests.el b/test/hmouse-drv-tests.el index e06cf3bb00..e83cf7aa9d 100644 --- a/test/hmouse-drv-tests.el +++ b/test/hmouse-drv-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 28-Feb-21 at 22:52:00 -;; Last-Mod: 20-Mar-22 at 20:04:47 by Mats Lidell +;; Last-Mod: 15-May-22 at 23:42:24 by Bob Weiner ;; ;; Copyright (C) 2021-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -497,16 +497,12 @@ (ert-deftest hbut-load-modifier-with-plain-file-loads-file-from-load-path () "Path prefix - filename without directory will load from`load-path'." + (setq features (delq 'tutorial features)) (with-temp-buffer (insert "\"-tutorial.el\"") (goto-char 2) - (let ((was-called nil)) - (cl-letf (((symbol-function 'load) - (lambda (filename) - (setq was-called - (should (string= (locate-library "tutorial.el") filename)))))) - (action-key) - (should was-called))))) + (action-key) + (should (featurep 'tutorial)))) (ert-deftest hbut-key-press-on-hyphen-in-elisp-symbol () "Key press on hyphen in elisp symbol uses smart-lisp-find-tag. diff --git a/test/hpath-tests.el b/test/hpath-tests.el index 6ed59eb700..95990011b0 100644 --- a/test/hpath-tests.el +++ b/test/hpath-tests.el @@ -150,13 +150,9 @@ (ert-deftest hpath:load-modifier-with-plain-file-loads-file-from-load-path () "Path prefix - with filename without diretory will load from`load-path'." - (let ((was-called nil)) - (cl-letf (((symbol-function 'load) - (lambda (filename) - (setq was-called - (should (string= (locate-library "tutorial.el") filename)))))) - (hpath:find "-tutorial.el") - (should was-called)))) + (setq features (delq 'tutorial features)) + (hpath:find "-tutorial.el") + (should (featurep 'tutorial))) (ert-deftest hpath:substitute-value-test () "Environment and Lisp variables shall be substituted in a path."