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

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

[elpa] externals/hyperbole 281384b906 1/2: Add drag create of ebut to or


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 281384b906 1/2: Add drag create of ebut to org id; improve delim path recognition
Date: Sun, 12 Mar 2023 12:57:53 -0400 (EDT)

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

    Add drag create of ebut to org id; improve delim path recognition
    
    Improve org id handling
---
 ChangeLog   | 20 +++++++++++++++++++-
 hactypes.el | 31 ++++++++++++++++++++-----------
 hbut.el     |  8 ++++----
 hibtypes.el | 43 +++++++++++++++++++++++++++----------------
 hpath.el    |  9 +++++++--
 hui.el      | 15 ++++++++++-----
 6 files changed, 87 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eca194a9c0..c14f53314c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2023-03-11  Bob Weiner  <rsw@gnu.org>
+
+* hibtypes.el (org-id): Set ibut label and return id when at id def so
+    can drag to direct link to an org id definition (or reference).
+
+* hbut.el (ibut:at-to-name-p): Fix to handle when 'start' of name is not
+    found.
+
+* hibtypes.el (org-id):
+  hactypes.el (org-id-marker-display): Rename to 'link-to-org-id-marker'.
+              (link-to-org-id): Add to jump to an org id referent location.
+  hui.el (hui:link-possible-types): Add 'link-to-org-id' support.
+
+* hpath.el (hpath:delimited-possible-path): Add support for HTML &quot;
+    quoting and embedded double quotes.
+  hibtypes.el (Info-node): Better handle embedded double quotes and add
+    support for HTML &quot; quoting.
+
 2023-03-10  Bob Weiner  <rsw@gnu.org>
 
 * hyrolo.el (hyrolo-find-file): Prevent 'outline-regexp' getting stuck
@@ -40,7 +58,7 @@
   hactypes.el (org-id-marker-display): Add to display Org Roam and Org
    ID referents.  Set this context to one of the lowest priorities.
 
-* hui-mouse.el (smart-outline, smart-outline-
+* hui-mouse.el (smart-outline, smart-outline-assist):
   man/hyperbole.texi (Smart Key - Emacs Outline Mode): Remove calling
     of eol functions when not at the end of line, e.g. when on a
     non-heading line.  This was just too unexpected a behavior in
diff --git a/hactypes.el b/hactypes.el
index 50c94b0be6..546b188126 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:      1-Mar-23 at 22:13:03 by Bob Weiner
+;; Last-Mod:     11-Mar-23 at 13:04:56 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -590,6 +590,25 @@ information on how to specify a mail reader to use."
        (hypb:error "(link-to-mail): No msg `%s' in file \"%s\""
                    mail-msg-id mail-file)))))
 
+(defact link-to-org-id (id)
+  "Display the Org entry, if any, for ID."
+  (when (stringp id)
+    (let (m
+         (inhibit-message t)) ;; Inhibit org-id-find status msgs
+      (when (setq m (or (and (featurep 'org-roam) (org-roam-id-find id 
'marker))
+                       (org-id-find id 'marker)))
+       (hact #'link-to-org-id-marker m)))))
+
+(defact link-to-org-id-marker (marker)
+  "Display the Org entry, if any, at MARKER.
+See doc of `ibtypes::org-id' for usage."
+    (unless (markerp marker)
+      (error "(link-to-org-id-marker): Argument must be a marker, not %s" 
marker))
+    (org-mark-ring-push)
+    (hact #'link-to-buffer-tmp (marker-buffer marker) marker)
+    (move-marker marker nil)
+    (org-show-context))
+
 (defact link-to-regexp-match (regexp n source &optional buffer-p)
   "Find REGEXP's Nth occurrence in SOURCE and display location at window top.
 SOURCE is a pathname unless optional BUFFER-P is non-nil, then SOURCE must be
@@ -674,16 +693,6 @@ Uses `hpath:display-where' setting to control where the 
man page is displayed."
   (let ((Man-notify-method 'meek))
     (hpath:display-buffer (man topic))))
 
-(defact org-id-marker-display (marker)
-  "Display the Org entry, if any, at MARKER.
-See doc of `ibtypes::org-id' for usage."
-    (unless (markerp marker)
-      (error "(org-id-marker-display): Argument must be a marker, not %s" 
marker))
-    (org-mark-ring-push)
-    (hact #'link-to-buffer-tmp (marker-buffer marker) marker)
-    (move-marker marker nil)
-    (org-show-context))
-
 (defact rfc-toc (&optional buf-name opoint sections-start)
   "Compute and display summary of an Internet rfc in BUF-NAME.
 Assume point has already been moved to start of region to summarize.
diff --git a/hbut.el b/hbut.el
index a931bac54a..c38dd5fec1 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:     29-Jan-23 at 02:39:52 by Bob Weiner
+;; Last-Mod:     11-Mar-23 at 17:16:43 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1967,9 +1967,9 @@ and lbl-key properties of IBUT.  Return t if name is 
found, else nil."
        move-flag
        name
        start)
-    (when (or (ibut:is-p ibut)
-             (setq ibut (ibut:at-p)))
-      (setq start (hattr:get ibut 'lbl-start))
+    (when (and (or (ibut:is-p ibut)
+                  (setq ibut (ibut:at-p)))
+              (setq start (hattr:get ibut 'lbl-start)))
       (goto-char start)
       (forward-line 0)
       (while (search-forward ibut:label-start start t)
diff --git a/hibtypes.el b/hibtypes.el
index e22a36fb0f..43a8ee18e2 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:      8-Mar-23 at 22:12:06 by Bob Weiner
+;; Last-Mod:     11-Mar-23 at 17:42:25 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -138,26 +138,33 @@ line and check for a source reference line again."
 (defib org-id ()
   "Display Org roam or Org node referenced by id at point, if any.
 If on the :ID: definition line, do nothing and return nil.
-If the id location is found, return non-nil."
+If the referenced location is found, return non-nil."
   (when (featurep 'org-id)
-    (let ((id (thing-at-point 'symbol t)) ;; Could be a uuid or some other 
form of id
-         m)
+    (let* ((id (thing-at-point 'symbol t)) ;; Could be a uuid or some other 
form of id
+           (bounds (when id (bounds-of-thing-at-point 'symbol)))
+          (start (when bounds (car bounds)))
+          (end   (when bounds (cdr bounds)))
+          m)
       ;; Ignore ID definitions or when not on a possible ID
-      (if (and (not assist-flag)
-              (save-excursion (beginning-of-line)
-                              (re-search-forward ":\\(CUSTOM_\\)?ID:[ \t]+"
-                                                 (line-end-position) t)))
-         (hact #'message "On ID definition; use {C-u M-RET} to copy a link to 
an ID.")
-       (when (and id
-                  (let ((inhibit-message t)) ;; Inhibit org-id-find status msgs
-                    (setq m (or (and (featurep 'org-roam) (org-roam-id-find id 
'marker))
-                                (org-id-find id 'marker)))))
-         (hact #'org-id-marker-display m))))))
+      (when id
+       (when (and start end)
+         (ibut:label-set id start end))
+       (if (and (not assist-flag)
+                (save-excursion (beginning-of-line)
+                                (re-search-forward ":\\(CUSTOM_\\)?ID:[ \t]+"
+                                                   (line-end-position) t)))
+           (progn
+             (hact #'message "On ID definition; use {C-u M-RET} to copy a link 
to an ID.")
+             (hact #'identity id))
+         (when (let ((inhibit-message t)) ;; Inhibit org-id-find status msgs
+                 (setq m (or (and (featurep 'org-roam) (org-roam-id-find id 
'marker))
+                             (org-id-find id 'marker))))
+           (hact #'link-to-org-id-marker m)))))))
 
 (defun org-id:help (hbut)
   "Copy link to kill ring of an Org roam or Org node referenced by id at point.
 If on the :ID: definition line, do nothing and return nil.
-If the id location is found, return non-nil."
+If the referenced location is found, return non-nil."
   (when (featurep 'org-id)
     (let ((id (thing-at-point 'symbol t)) ;; Could be a uuid or some other 
form of id
          m
@@ -1363,8 +1370,12 @@ Also make a \"(filename)itemname\" button display the 
associated Info index item
 Examples are \"(hyperbole)Implicit Buttons\" and ``(hyperbole)C-c /''.
 
 Activates only if point is within the first line of the Info-node name."
-  (let* ((node-ref-and-pos (or (hbut:label-p t "\"" "\"" t t)
+  (let* ((node-ref-and-pos (or ;; HTML
+                              (hbut:label-p t "&quot;" "&quot;" t t)
+                              ;; Embedded double quotes
                               (hbut:label-p t "\\\"" "\\\"" t t)
+                              ;; Double quotes
+                              (hbut:label-p t "\"" "\"" t t)
                                ;; Typical GNU Info references; note
                                ;; these are special quote marks, not the
                                ;; standard ASCII characters.
diff --git a/hpath.el b/hpath.el
index 8c1b67d16c..7324993366 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:      7-Mar-23 at 21:55:28 by Bob Weiner
+;; Last-Mod:     11-Mar-23 at 12:36:49 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1074,7 +1074,7 @@ ACTION-STR is used at the start of a prompt to choose the 
path."
                paths (and path-value
                           (split-string path-value (if (string-match ";" 
path-value) ";" ":") nil "\\s-")))
       (setq paths (sort (mapcar (lambda (path) (if (string-empty-p path) "." 
path)) paths) #'string-lessp))
-      (unless (memq t (mapcar (lambda (mode) (and (fboundp mode) (symbol-value 
mode))) hpath:auto-completing-read-modes))
+      (unless (memq t (mapcar (lambda (mode) (when (fboundp mode) 
(symbol-value mode))) hpath:auto-completing-read-modes))
        (kbd-key:key-series-to-events "?"))
       (completing-read (format "%s path from ${%s}: "
                               (if (stringp action-str) action-str "Choose")
@@ -1095,6 +1095,11 @@ end-pos) or nil."
   ;; Prevents MSWindows to Posix path substitution
   (let ((hyperb:microsoft-os-p t))
     (or (hargs:delimited "file://" "\\s-" nil t include-positions)
+       ;; Filenames in HTML
+       (hargs:delimited "&quot;" "&quot;" nil nil include-positions "[`'’]")
+       ;; Embedded double quoted filenames
+       (hargs:delimited "\\\"" "\\\"" nil nil include-positions "[`'’]")
+       ;; Double quoted filenames
        (hargs:delimited "\"" "\"" nil nil include-positions "[`'’]")
        ;; Filenames in Info docs or Python files
        (hargs:delimited "[`'‘]" "[`'’]" t t include-positions "\"")
diff --git a/hui.el b/hui.el
index e8f8a146ce..87c25c79f9 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:     20-Jan-23 at 23:16:41 by Mats Lidell
+;; Last-Mod:     11-Mar-23 at 15:38:26 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1522,9 +1522,14 @@ Buffer without File      link-to-buffer-tmp"
                       (list 'link-to-ebut lbl-key))
                      (hbut-sym
                       (list 'link-to-ibut lbl-key (or buffer-file-name 
(buffer-name)))))
-               (cond ((and (require 'bookmark)
-                            (derived-mode-p #'bookmark-bmenu-mode))
-                       (list 'link-to-bookmark (bookmark-bmenu-bookmark))))
+               (when (and (featurep 'org-id) (derived-mode-p 'org-mode 
'hyrolo-mode))
+                 (save-excursion
+                   (beginning-of-line)
+                   (when (looking-at "[ \t]*:ID:[ \t]+\\([^ \t\r\n\f]+\\)")
+                     (list 'link-to-org-id (match-string 1)))))
+               (and (require 'bookmark)
+                     (derived-mode-p #'bookmark-bmenu-mode)
+                     (list 'link-to-bookmark (bookmark-bmenu-bookmark)))
                (cond ((derived-mode-p #'Info-mode)
                       (if (and Info-current-node
                                (member Info-current-node
@@ -1571,7 +1576,7 @@ Buffer without File      link-to-buffer-tmp"
                    (end-of-line)
                    (let ((heading (buffer-substring-no-properties
                                    (point)
-                                   (progn (beginning-of-line) (point))))
+                                   (line-end-position)))
                          (occur 1))
                      (while (search-backward heading nil t)
                        (setq occur (1+ occur)))



reply via email to

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