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

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

[elpa] externals/hyperbole 530510ae6e 1/2: Fix Org, Klink and Info link


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 530510ae6e 1/2: Fix Org, Klink and Info link issues
Date: Sun, 22 May 2022 17:57:39 -0400 (EDT)

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

    Fix Org, Klink and Info link issues
---
 ChangeLog               | 24 ++++++++++++++++++++++++
 FAST-DEMO               |  4 ++--
 hactypes.el             | 14 +++++++-------
 hmouse-drv.el           |  2 +-
 hpath.el                | 16 ++++++++++------
 hsys-org.el             | 10 +++++++++-
 hui-mouse.el            | 16 ++++++++--------
 hyperbole.el            |  4 ++--
 kotl/kcell.el           |  3 ++-
 kotl/klink.el           | 14 +++++---------
 test/smart-org-tests.el | 32 ++++++++++++++++----------------
 11 files changed, 86 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 16edd610a5..54b1ae0881 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2022-05-22  Bob Weiner  <rsw@gnu.org>
+
+* hpath.el (hpath:internal-display-alist): Fix so Info files with non-absolute
+    directories outside of the 'Info-directory-list' are resolved properly,
+    e.g. "man/hyperbole.info".
+
+* hui-mouse.el (hkey-alist, smart-org): Remove _assist-flag from 'smart-org' 
calls
+    since already use global 'assist-flag' instead.
+
+* hsys-org.el (hsys-org-meta-return): Add this and autoload it so can centrally
+    control Hyperbole calls to 'org-meta-return'.  Also, fix passing of 
non-numeric
+    args to that function, e.g. '(4).
+  hui-mouse.el (action-key-error, assist-key-error, smart-org):
+  test/smart-org-tests.el 
(smart-org-mode-with-smart-keys-buttons-on-delimited-thing-calls-org-meta-return,
+    smart-org-mode-with-no-smart-keys-on-hypb-button-calls-org-meta-return,
+    smart-org-mode-with-no-smart-keys-on-org-link-is-org-meta-return): Call 
'hsys-org-meta-return'.
+
+* kotl/klink.el (link-to-kotl): Fix and remove 'kcell:ref-to-id' calls because
+    current buffer will not be set to the Koutline file yet if link contains a 
file
+    reference.
+
+* hactypes.el (link-to-kcell): Fix ordering of cond clauses so file part of 
links
+    are properly handled before handling cell-ref part.
+
 2022-05-22  Mats Lidell  <matsl@gnu.org>
 
 * test/kexport-tests.el:
diff --git a/FAST-DEMO b/FAST-DEMO
index 1fa2d5b38c..edc8557a18 100644
--- a/FAST-DEMO
+++ b/FAST-DEMO
@@ -153,7 +153,7 @@
        A BLANK buffer fills in the grid if there are not enough Emacs Lisp
        ones.
 
-    {C-x d ${hyperb:dir} RET}
+    {C-x 4 d ${hyperb:dir} RET}
 
        Dired the Hyperbole home directory based on its variable.
 
@@ -176,7 +176,7 @@
     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 C-u M-! which SPC bash RET RET }
+    { M-x set-variable RET shell-file-name RET C-u M-! /usr/bin/env SPC bash 
RET RET }
 
        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
diff --git a/hactypes.el b/hactypes.el
index f7d6f17510..3413b32b4e 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:      2-May-22 at 00:25:26 by Bob Weiner
+;; Last-Mod:     22-May-22 at 12:52:36 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -540,17 +540,17 @@ If FILE is nil, use the current buffer.
 If CELL-REF is nil, show the first cell in the view."
   (interactive "fKotl file to link to: \n+KKcell to link to: ")
   (require 'kfile)
-  (cond ((and (stringp cell-ref) (> (length cell-ref) 0)
-             (eq ?| (aref cell-ref 0)))
-        ;; Activate view spec in current window.
-        (kotl-mode:goto-cell cell-ref))
-       ((if file
+  (cond        ((if file
             (hpath:find file)
           (hpath:display-buffer (current-buffer)))
         (if cell-ref
             (kotl-mode:goto-cell cell-ref)
           (kotl-mode:beginning-of-buffer))
-        (recenter 0))))
+        (recenter 0))
+       ((and (stringp cell-ref) (> (length cell-ref) 0)
+             (eq ?| (aref cell-ref 0)))
+        ;; Activate view spec in current window.
+        (kotl-mode:goto-cell cell-ref))))
 
 (defact link-to-mail (mail-msg-id &optional mail-file)
   "Display mail msg with MAIL-MSG-ID from optional MAIL-FILE.
diff --git a/hmouse-drv.el b/hmouse-drv.el
index e2551a355e..16b51666b4 100644
--- a/hmouse-drv.el
+++ b/hmouse-drv.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-90
-;; Last-Mod:     15-May-22 at 00:12:19 by Bob Weiner
+;; Last-Mod:     22-May-22 at 09:59:49 by Bob Weiner
 ;;
 ;; Copyright (C) 1989-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
diff --git a/hpath.el b/hpath.el
index 7c16178075..92e971f63e 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:     15-May-22 at 23:36:25 by Bob Weiner
+;; Last-Mod:     22-May-22 at 13:34:43 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -382,11 +382,15 @@ See the function `hpath:get-external-display-alist' for 
detailed format document
      (concat hpath:info-suffix
             
"\\|/\\(info\\|INFO\\)/[^.]+$\\|/\\(info-local\\|INFO-LOCAL\\)/[^.]+$")
      (lambda (file)
-       (if (and (string-match hpath:info-suffix file)
-               (match-beginning 1))
-          ;; Removed numbered trailer to get basic filename.
-          (setq file (concat (substring-no-properties file 0 (match-beginning 
1))
-                             (substring-no-properties file (match-end 1)))))
+       (when (and (string-match hpath:info-suffix file)
+                 (match-beginning 1))
+        ;; Removed numbered trailer to get basic filename.
+        (setq file (concat (substring-no-properties file 0 (match-beginning 1))
+                           (substring-no-properties file (match-end 1)))))
+       ;; Ensure that Info files with non-absolute directories outside of the
+       ;; `Info-directory-list' are resolved properly, e.g. 
"man/hyperbole.info".
+       (unless (file-name-absolute-p file)
+        (setq file (expand-file-name "man/hyperbole.info")))
        (require 'info)
        ;; Ensure that *info* buffer is displayed in the right place.
        (hpath:display-buffer (current-buffer))
diff --git a/hsys-org.el b/hsys-org.el
index cfa2152d99..289b278e4d 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     2-Jul-16 at 14:54:14
-;; Last-Mod:     15-May-22 at 00:50:06 by Bob Weiner
+;; Last-Mod:     22-May-22 at 13:08:54 by Bob Weiner
 ;;
 ;; Copyright (C) 2016-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -45,6 +45,14 @@
                                (where-is-internal #'action-key 
hyperbole-mode-map)))
       t)))
 
+;;;###autoload
+(defun hsys-org-meta-return (&optional arg)
+  "Call `org-meta-return' with the numeric value of any prefix ARG when given."
+  (interactive "P")
+  (if arg
+      (org-meta-return (prefix-numeric-value arg))
+    (org-meta-return)))
+
 ;;;###autoload
 (defcustom hsys-org-enable-smart-keys 'unset
   "This option applies only in Org major/minor modes when hyperbole-mode is 
active.
diff --git a/hui-mouse.el b/hui-mouse.el
index 1d1e3a3408..2b982dcbeb 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-89
-;; Last-Mod:     14-May-22 at 18:31:38 by Bob Weiner
+;; Last-Mod:     22-May-22 at 13:04:43 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -60,14 +60,14 @@
   "If in Org mode and Hyperbole shares {M-RET}, run org-meta-return, else 
signal an error."
   (if (and (funcall hsys-org-mode-function)
           (hsys-org-meta-return-shared-p))
-      (hact 'org-meta-return current-prefix-arg)
+      (hact 'hsys-org-meta-return 'current-prefix-arg)
     (hypb:error "(Hyperbole Action Key): No action defined for this context; 
try another location")))
 
 (defun assist-key-error ()
   "If in Org mode and Hyperbole shares {M-RET}, run org-meta-return, else 
signal an error."
   (if (and (funcall hsys-org-mode-function)
           (hsys-org-meta-return-shared-p))
-      (hact 'org-meta-return current-prefix-arg)
+      (hact 'hsys-org-meta-return 'current-prefix-arg)
     (hypb:error "(Hyperbole Assist Key): No action defined for this context; 
try another location")))
 
 (defcustom action-key-default-function #'action-key-error
@@ -179,8 +179,8 @@ Its default value is #'smart-scroll-down.  To disable it, 
set it to
     ;; Handle any Org mode-specific contexts
     ((and (not (hyperb:stack-frame '(smart-org)))
          (let ((hrule:action #'actype:identity))
-           (smart-org current-prefix-arg))) .
-     ((smart-org current-prefix-arg) . (smart-org current-prefix-arg)))
+           (smart-org))) .
+     ((smart-org) . (smart-org)))
     ;; Ivy minibuffer completion mode
     ((and (boundp 'ivy-mode) ivy-mode (minibuffer-window-active-p 
(selected-window))) .
      ((ivy-done) . (ivy-dispatching-done)))
@@ -1613,7 +1613,7 @@ If not on a file name, returns nil."
 ;;; smart-org functions
 ;;; ************************************************************************
 
-(defun smart-org (&optional _assist-flag)
+(defun smart-org ()
   "If `hsys-org-enable-smart-keys' is non-nil, follow Org mode references, 
cycles outline visibility and executes code blocks.
 
 When the Action Key is pressed:
@@ -1659,7 +1659,7 @@ handled by the separate implicit button type, 
`org-link-outside-org-mode'."
     (let (start-end)
       (cond ((not hsys-org-enable-smart-keys)
             (when (hsys-org-meta-return-shared-p)
-              (hact 'org-meta-return current-prefix-arg))
+              (hact 'hsys-org-meta-return 'current-prefix-arg))
             ;; Ignore any further Smart Key non-Org contexts
             t)
            ((eq hsys-org-enable-smart-keys t)
@@ -1719,7 +1719,7 @@ handled by the separate implicit button type, 
`org-link-outside-org-mode'."
                    nil)
                   (t
                    (when (hsys-org-meta-return-shared-p)
-                     (hact 'org-meta-return current-prefix-arg))
+                     (hact 'hsys-org-meta-return 'current-prefix-arg))
                    ;; Ignore any further Smart Key non-Org contexts
                    t)))
            (t
diff --git a/hyperbole.el b/hyperbole.el
index 03e575a25e..a3553df582 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -5,7 +5,7 @@
 ;; Author:           Bob Weiner
 ;; Maintainer:       Bob Weiner <rsw@gnu.org>, Mats Lidell <matsl@gnu.org>
 ;; Created:          06-Oct-92 at 11:52:51
-;; Last-Mod:     11-May-22 at 01:16:34 by Bob Weiner
+;; Last-Mod:     22-May-22 at 12:48:36 by Bob Weiner
 ;; Released:         01-May-22
 ;; Version:          8.0.1pre
 ;; Keywords:         comm, convenience, files, frames, hypermedia, languages, 
mail, matching, mouse, multimedia, outlines, tools, wp
@@ -251,7 +251,7 @@ of the commands."
     ;; and load the Hyperbole mouse key bindings.
     (unless (where-is-internal #'hkey-either)
       ;; Need to map all these variants to ensure can override
-      ;; org-meta-return in Org mode when desired.
+      ;; `org-meta-return' in Org mode when desired.
       (mapc (lambda (key) (hkey-set-key (kbd key) #'hkey-either))
            '("\M-\C-m" "M-<return>" "M-RET" "ESC <return>" "ESC RET")))
     ;;
diff --git a/kotl/kcell.el b/kotl/kcell.el
index 95b721797f..3272014198 100644
--- a/kotl/kcell.el
+++ b/kotl/kcell.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-May-93
-;; Last-Mod:      3-Apr-22 at 16:23:56 by Bob Weiner
+;; Last-Mod:     22-May-22 at 10:22:02 by Bob Weiner
 ;;
 ;; Copyright (C) 1993-2021  Free Software Foundation, Inc.
 ;; See the "../HY-COPY" file for license information.
@@ -71,6 +71,7 @@ The idstamp of the top cell is always 0 and this cell stores 
the idstamp-counter
 
 (defalias 'kcell:plist 'identity)
 
+;;;###autoload
 (defun kcell:ref-to-id (cell-ref &optional kviewspec-flag)
   "When CELL-REF is valid, return a CELL-REF string converted to a cell 
idstamp (integer).
 If CELL-REF contains both a relative and a permanent id, the permanent id is
diff --git a/kotl/klink.el b/kotl/klink.el
index 145ab5025b..91fb1a3251 100644
--- a/kotl/klink.el
+++ b/kotl/klink.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Nov-93 at 12:15:16
-;; Last-Mod:     17-Apr-22 at 21:02:07 by Bob Weiner
+;; Last-Mod:     22-May-22 at 12:52:17 by Bob Weiner
 ;;
 ;; Copyright (C) 1993-2021  Free Software Foundation, Inc.
 ;; See the "../HY-COPY" file for license information.
@@ -232,25 +232,22 @@ LINK may be of any of the following forms; the <> are 
optional:
 See documentation for `kcell:ref-to-id' for valid cell-ref formats."
 
   (interactive "sKotl link specifier: ")
-  (or (stringp link) (error "(link-to-kotl): Non-string link argument, %s"
-                           link))
+  (unless (stringp link)
+    (error "(link-to-kotl): Non-string link argument, %s" link))
   (cond
    ((or (string-match (format "\\`<?\\s-*@\\s-*\\(%s\\)\\s-*>?\\'"
                              klink:cell-ref-regexp) link)
        (string-match (format "\\`<?\\s-*\\([|:]%s\\)\\s-*>?\\'"
                              klink:cell-ref-regexp) link))
     ;; < @ cell-ref > or < |viewspec > or < :augment-viewspec >
-    (hact 'link-to-kcell
-         nil
-         (kcell:ref-to-id (match-string 1 link) t)))
+    (hact 'link-to-kcell nil (match-string 1 link)))
    ((and (string-match
          (format "\\`<?\\s-*\\([^ 
\t\n\r\f,<>]+\\)\\s-*\\(,\\s-*\\(%s\\)\\)?\\s-*>?\\'"
                  klink:cell-ref-regexp)
          link)
         (match-end 3))
     ;; < pathname, cell-ref >
-    (hact 'link-to-kcell (match-string 1 link)
-         (kcell:ref-to-id (match-string 3 link) t)))
+    (hact 'link-to-kcell (match-string 1 link) (match-string 3 link)))
    ((string-match
      "\\`<?\\s-*\\(\\([-!&]\\)?\\s-*[^ \t\n\r\f,<>]+\\)\\s-*>?\\'" link)
     ;; < [-!&] pathname >
@@ -261,7 +258,6 @@ See documentation for `kcell:ref-to-id' for valid cell-ref 
formats."
 ;;; Private functions
 ;;; ************************************************************************
 
-
 (defun klink:act (link start-pos)
   (let ((obuf (current-buffer)))
     ;; Perform klink's action which is to jump to link referent.
diff --git a/test/smart-org-tests.el b/test/smart-org-tests.el
index e76197d1cf..60a59ce6ca 100644
--- a/test/smart-org-tests.el
+++ b/test/smart-org-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    23-Apr-21 at 22:21:00
-;; Last-Mod:      1-Mar-22 at 23:23:32 by Mats Lidell
+;; Last-Mod:     22-May-22 at 13:44:31 by Bob Weiner
 ;;
 ;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -54,7 +54,7 @@
 
 ;; Hyperbole Button
 (ert-deftest smart-org-mode-with-smart-keys-on-hypb-button-activates ()
-  "With smart keys on hypb button activates."
+  "With smart keys on hypb button activates the button."
   (with-temp-buffer
     (let ((hsys-org-enable-smart-keys t))
       (org-mode)
@@ -62,6 +62,16 @@
       (goto-char 1)
       (hy-test-helpers:hypb-function-should-call-hpath:find 'ibtypes::pathname 
"/tmp"))))
 
+;; Hyperbole Button
+(ert-deftest smart-org-mode-with-smart-keys-buttons-on-hypb-button-activates ()
+  "With smart keys as buttons on hypb button activates the button."
+  (with-temp-buffer
+    (let ((hsys-org-enable-smart-keys 'buttons))
+      (org-mode)
+      (insert "/tmp")
+      (goto-char 1)
+      (hy-test-helpers:hypb-function-should-call-hpath:find 'action-key 
"/tmp"))))
+
 ;; Org Link
 (ert-deftest smart-org-mode-with-smart-keys-on-org-link-activates ()
   "With smart keys on `org-mode' link activates link."
@@ -83,21 +93,11 @@
       (insert "(hy per bo le)\n")
       (goto-char 14)
       (with-mock
-       (mock (org-meta-return nil) => t)
+       (mock (hsys-org-meta-return nil) => t)
        (smart-org)))))
 
-;; Hyperbole Button
-(ert-deftest smart-org-mode-with-smart-keys-buttons-on-hypb-button-activates ()
-  "With smart keys as buttons on hypb button activates."
-  (with-temp-buffer
-    (let ((hsys-org-enable-smart-keys 'buttons))
-      (org-mode)
-      (insert "/tmp")
-      (goto-char 1)
-      (hy-test-helpers:hypb-function-should-call-hpath:find 'action-key 
"/tmp"))))
-
 ;; Org Link
-(ert-deftest 
smart-org-mode-with-smart-keys-buttons-on-org-link-calls-org-meta-return ()
+(ert-deftest smart-org-mode-with-smart-keys-buttons-on-org-link-activates ()
   "With smart keys as buttons on `org-mode' link activates link."
   (with-temp-buffer
     (let ((hsys-org-enable-smart-keys 'buttons))
@@ -130,7 +130,7 @@
       (insert "/tmp")
       (goto-char 1)
       (with-mock
-       (mock (org-meta-return nil) => t)
+       (mock (hsys-org-meta-return nil) => t)
        (smart-org)))))
 
 ;; Org Link
@@ -142,7 +142,7 @@
       (insert "[[/tmp][desc]]")
       (goto-char 9)
       (with-mock
-       (mock (org-meta-return nil) => t)
+       (mock (hsys-org-meta-return nil) => t)
        (smart-org)))))
 
 ;; Compilation requires `el-mock' which is not `Package-Require'd.



reply via email to

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