emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 44262d14a7 14/19: Resolve all but one test ca


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 44262d14a7 14/19: Resolve all but one test case issues from the latest updates
Date: Sun, 24 Jul 2022 16:57:38 -0400 (EDT)

branch: externals/hyperbole
commit 44262d14a73dd69f067224bf48aa88c11cd64042
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Resolve all but one test case issues from the latest updates
    
    Have to make ibut:at-p set lbl-start and lbl-end to ibut text
    position even when point is on the ibut's preceding name.
---
 ChangeLog      | 28 +++++++++++++++++++++++++++
 hact.el        |  2 +-
 hactypes.el    |  6 +++---
 hbut.el        | 61 ++++++++++++++++++++++++++++++++++------------------------
 hib-debbugs.el |  4 ++--
 hibtypes.el    |  8 +++-----
 hui-mini.el    |  4 ++--
 hui.el         |  9 +++++++--
 8 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 317b847ea9..5ba684c69f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2022-07-23  Bob Weiner  <rsw@gnu.org>
+
+* hbut.el (ibut:to): Clear any hbut:current attributes before trying
+   to find the matching ibut.
+
+* hibtypes.el (action): Display the result of evaluating the action
+    in the minibuffer for all types of expressions.
+  hactypes.el (display-value, display-variable): Fix to display
+    Lisp-readable values.
+
+* hui.el (hui:gibut-create): Add (ibut:create) call so 'hbut:current
+    stores the attributes of the newly created global button.
+
+* hbut.el (hbut:action): If action defined, return only first
+    element to match the return when actype is used.
+          (hbut:act): Use action attribute if defined.
+         (ibut:create): Prevent removal of 1st arg if actype
+    is set.
+
 * hibtypes.el (elisp-compiler-msg): Add support for ERT "Test <symbol>"
     lines to jump to the def of the symbol and for symbol and pathname
     references from backtraces in ERT output.
@@ -21,6 +40,15 @@
   test/hy-test-dependencies.el (hy-test-ensure-package-installed):
     Simplified by defining this function.
 
+2022-07-22  Bob Weiner  <rsw@gnu.org>
+
+* hmouse-drv.el (hkey-debug): Use 'action' attribute if set, otherwise,
+    use 'actype' and 'args'.
+
+* hbut.el (ibut:create): Add 'dir' key parameter and set as hbut:current
+    attribute.  Remove '(or args)' as that was preventing set of
+ hbut:current attributes.
+
 2022-07-17  Bob Weiner  <rsw@gnu.org>
 
 * hmouse-drv.el (hkey-debug): Add print of all button properties when on
diff --git a/hact.el b/hact.el
index 131bf9c22f..9ad080418c 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:     17-Jul-22 at 12:58:33 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 21:25:44 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
diff --git a/hactypes.el b/hactypes.el
index 2ac2a4d1e8..3e48657192 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    23-Sep-91 at 20:34:36
-;; Last-Mod:     12-Jul-22 at 01:21:40 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 22:25:35 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -65,13 +65,13 @@ Return any non-nil value or t."
   "Display a message showing VALUE (a symbol) and its value.
 Return any non-nil value or t."
   (let ((result (eval value)))
-    (message "%s" result)
+    (message "%S" result)
     (or result t)))
 
 (defact display-variable (var)
   "Display a message showing VAR (a symbol) and its value.
 Return any non-nil value or t."
-  (message "%s = %s" var (symbol-value var))
+  (message "%s = %S" var (symbol-value var))
   (or (symbol-value var) t))
 
 (defact eval-elisp (lisp-expr)
diff --git a/hbut.el b/hbut.el
index a391c8b86c..9864e3c5b2 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:     23-Jul-22 at 01:57:12 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 23:39:56 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -650,7 +650,7 @@ argument.
 
 For interactive creation, use `hui:gbut-create' instead."
   (save-excursion
-    (with-current-buffer (find-file-noselect (expand-file-name hbmap:filename 
hbmap:dir-user))
+    (with-current-buffer (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user))
       (save-excursion
        (goto-char (point-max))
        (when (not (bolp))
@@ -889,6 +889,7 @@ Default is 'hbut:current."
     (setq hbut 'hbut:current))
   (cond ((hbut:is-p hbut)
         (let ((orig-point (point-marker))
+              (action (hattr:get hbut 'action))
               text-point)
           (when (ibut:is-p hbut)
             ;; Determine whether point is already within hbut; if
@@ -921,12 +922,12 @@ Default is 'hbut:current."
                              (>= delim-text-end (point)))
                   (ibut:to-text (hattr:get hbut 'lbl-key))))))
           (setq text-point (point-marker))
-          (prog1 (apply hrule:action
-                        (hattr:get hbut 'actype)
-                        (hattr:get hbut 'args))
-            ;; Restore point as it was prior to ibut:to-text call if the action
-            ;; switched buffers or did not move point within the
-            ;; current buffer.
+          (prog1 (if action
+                     (apply hrule:action action)
+                   (apply hrule:action (hattr:get hbut 'actype) (hattr:get 
hbut 'args)))
+            ;; Restore point as it was prior to `ibut:to-text' call
+            ;; if the action switched buffers or did not move point
+            ;; within the current buffer.
             (when (or (equal text-point (point-marker))
                       (not (eq (current-buffer) (marker-buffer orig-point))))
               (with-current-buffer (marker-buffer orig-point)
@@ -942,10 +943,10 @@ Default is 'hbut:current."
         (hypb:error "(hbut:act): Invalid Hyperbole button: %s" hbut))))
 
 (defun    hbut:action (hbut)
-  "Return appropriate action for Hyperbole button symbol HBUT."
+  "Return appropriate action name/function for Hyperbole button symbol HBUT."
   (let ((categ (hattr:get hbut 'categ)) (atype) (action))
     (if (eq categ 'explicit)
-       (progn (setq action (hattr:get hbut 'action)
+       (progn (setq action (car (hattr:get hbut 'action))
                     atype  (hattr:get hbut 'actype))
               (if (= (length (symbol-name atype)) 2)
                   atype
@@ -1503,7 +1504,9 @@ excluding delimiters, not just one."
   (unless (eolp)
     (let* ((opoint (point))
           (name-start-end (ibut:label-p t nil nil t t))
-          (name (car name-start-end))
+          (name  (nth 0 name-start-end))
+          (start (nth 1 name-start-end))
+          (end   (nth 2 name-start-end))
           (lbl-key (or (ibut:label-to-key name)
                        (ibut:label-p nil "\"" "\"" nil t))))
       (unwind-protect
@@ -1511,7 +1514,7 @@ excluding delimiters, not just one."
            (when (not (hbut:outside-comment-p))
              ;; Skip past any optional name and separators
              (when name-start-end
-               (goto-char (nth 2 name-start-end))
+               (goto-char end)
                (if (looking-at ibut:label-separator-regexp)
                    ;; Move past up to 2 possible characters of ibut
                    ;; delimiters; this prevents recognizing labeled,
@@ -1523,7 +1526,8 @@ excluding delimiters, not just one."
                lbl-key
              ;; Check for an implicit button at current point, record its
              ;; attributes and return a button symbol for it.
-             (ibut:create)))
+             (ibut:create :name name :lbl-key lbl-key :lbl-start start
+                          :lbl-end end)))
        (goto-char opoint)))))
 
 (defun    ibut:at-type-p (ibut-type-symbol)
@@ -1548,6 +1552,9 @@ associated arguments from the button."
 Return nil if no implicit button at point."
   ;; :args is ignored unless :categ is also given.
 
+  ;; lbl-start and lbl-end should always be the start and end of the
+  ;; ibut text, excluding delimiters, not of its name.
+
   ;; Since the Smart Keys handle end-of-line and end-of-buffer
   ;; separately from whether point is within an implicit button,
   ;; always report not within one when point is at the end of a line.
@@ -1556,21 +1563,11 @@ Return nil if no implicit button at point."
     (let* ((types (htype:category 'ibtypes))
           ;; Global var used in (hact) function, don't delete.
           (hrule:action #'actype:identity)
-          (name-start-end (ibut:label-p t nil nil t t))
+          (lbl-key-start-end)
           (ibpoint (point-marker))
           (itype)
           (is-type categ))
 
-      (unless name
-       (setq name (nth 0 name-start-end)))
-      (unless lbl-key
-       (setq lbl-key (or (ibut:label-to-key name)
-                         (ibut:label-p nil "\"" "\"" nil))))
-      (unless lbl-start
-       (setq lbl-start (nth 1 name-start-end)))
-      (unless lbl-end
-       (setq lbl-end (nth 2 name-start-end)))
-
       (hattr:clear 'hbut:current)
       (unless is-type
        (while (and (not is-type) types)
@@ -1584,6 +1581,19 @@ Return nil if no implicit button at point."
          (setq types (cdr types))))
 
       (set-marker ibpoint nil)
+
+      (unless name
+       (setq name (ibut:label-p t nil nil nil t)))
+      (unless (and lbl-key lbl-start lbl-end)
+       (setq lbl-key-start-end (ibut:label-p nil "\"" "\"" t t)))
+      (unless lbl-key
+       (setq lbl-key (or (ibut:label-to-key name)
+                         (nth 0 lbl-key-start-end))))
+      (unless lbl-start
+       (setq lbl-start (nth 1 lbl-key-start-end)))
+      (unless lbl-end
+       (setq lbl-end (nth 2 lbl-key-start-end)))
+
       (when is-type
        (when name
          (hattr:set 'hbut:current 'name name))
@@ -1613,7 +1623,7 @@ Return nil if no implicit button at point."
                          (symtable:actype-p (car args))
                          ;; Regular Emacs Lisp function symbol
                          (car args)))
-             (hattr:set 'hbut:current 'args (cdr args))))
+             (hattr:set 'hbut:current 'args (if actype args (cdr args)))))
        'hbut:current))))
 
 (defun    ibut:delete (&optional but-sym)
@@ -1830,6 +1840,7 @@ the whole buffer."
   "Find the nearest implicit button with LBL-KEY (a label or label key) within 
the visible portion of the current buffer.
 Leave point inside the button text or its optional label, if it has one.
 Return the symbol for the button, else nil."
+  (hattr:clear 'hbut:current)
   (unless lbl-key
     (setq lbl-key (ibut:label-p nil nil nil nil t)))
   (hbut:funcall (lambda (lbl-key _buffer _key-src)
diff --git a/hib-debbugs.el b/hib-debbugs.el
index 245ed8e140..9bfa736a4c 100644
--- a/hib-debbugs.el
+++ b/hib-debbugs.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Jun-16 at 14:24:53
-;; Last-Mod:     24-Jan-22 at 00:18:32 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 19:55:32 by Bob Weiner
 ;;
 ;; Copyright (C) 2016, 2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -269,7 +269,7 @@ Ignore nil valued attributes.  Return t unless no 
attributes are printed."
                     (setq version (match-string 1))))
          (unless visiting-debbugs-src
            (kill-buffer debbugs-src-buffer)))
-       (when (not (equal version ""))
+       (when (and version (not (equal version "")))
          (version-list-<= (version-to-list "0.9.7") (version-to-list 
version)))))))
 
 (provide 'hib-debbugs)
diff --git a/hibtypes.el b/hibtypes.el
index ac1811c6f5..ba6580f93d 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 20:45:31
-;; Last-Mod:     23-Jul-22 at 18:26:19 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 22:32:54 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -1430,10 +1430,8 @@ arg1 ... argN '>'.  For example, <mail nil 
\"user@somewhere.org\">."
                 (setq args `(',actype)
                        action `(display-variable ',actype)
                        actype #'display-variable))
-               ((and (symbolp actype) (fboundp actype)
-                      (string-match "\\b\\(get\\|value\\)" (symbol-name 
actype)))
-                ;; For 'get' and 'value' functions, display the action
-                ;; result in the minibuffer
+               (t
+                ;; All other expressions, display the action result in the 
minibuffer
                 (setq args `(',action)
                        action `(display-value ',action)
                        actype #'display-value))))
diff --git a/hui-mini.el b/hui-mini.el
index c84bcdb55c..dce8d1852a 100644
--- a/hui-mini.el
+++ b/hui-mini.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Oct-91 at 20:13:17
-;; Last-Mod:     17-Jul-22 at 09:48:06 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 23:04:56 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -913,7 +913,7 @@ constructs.  If not given, the top level Hyperbole menu is 
used."
        ;; ("B")
        ;; ("C")
        ("Devdocs-Lookup"             hypb:devdocs-lookup)
-       ;; ("E")
+       ("Emacs-Index-Search"         emacs-index-search)
        ;; ("F")
        ;; ("G")
        ;; ("H")
diff --git a/hui.el b/hui.el
index 5b2a027d2a..d605683f65 100644
--- a/hui.el
+++ b/hui.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 21:42:03
-;; Last-Mod:     11-Jul-22 at 19:14:36 by Bob Weiner
+;; Last-Mod:     23-Jul-22 at 20:11:01 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -643,10 +643,11 @@ When in the global button buffer, the default is the 
button at point."
 Use `hui:gbut-create' to create a global explicit button."
   (interactive "sCreate global implicit button labeled: \nsButton text (with 
any delimiters): ")
   (let (but-buf
+       opoint
         delimited-label)
     (save-excursion
       (setq delimited-label (concat ibut:label-start lbl ibut:label-end)
-           but-buf (find-file-noselect (gbut:file)))
+           but-buf (hpath:find-noselect (gbut:file)))
       (hui:buf-writable-err but-buf "gibut-create")
       ;; This prevents movement of point which might be useful to user.
       (set-buffer but-buf)
@@ -654,7 +655,11 @@ Use `hui:gbut-create' to create a global explicit button."
        (goto-char (point-max))
         (unless (bolp)
          (insert "\n"))
+       (setq opoint (point))
         (insert delimited-label ": " text "\n")
+       (save-excursion
+         (goto-char (+ opoint (length ibut:label-start)))
+         (ibut:create))
        (save-buffer))
       (message "`%s' global implicit button created." lbl))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]