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

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

[elpa] externals/hyperbole 5bbc6da4e0 42/47: Fix annot-bib ibtype and ac


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 5bbc6da4e0 42/47: Fix annot-bib ibtype and actype; was not checking for [] delimiters
Date: Sun, 25 Jun 2023 15:58:39 -0400 (EDT)

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

    Fix annot-bib ibtype and actype; was not checking for [] delimiters
    
    Also add check that citation found is not actually the ref to a citation.
---
 ChangeLog   |  8 ++++++++
 hactypes.el | 14 ++++++++++----
 hibtypes.el | 14 +++++++++-----
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 69b41f4e3a..1d83422d87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-06-25  Bob Weiner  <rsw@gnu.org>
 
+* hibtypes.el (annot-bib): Fix missing check that annot-bib is between square
+    brackets.
+  hactypes.el (annot-bib): Beep/fail if when search for citation, point ends up
+    within the ibut reference rather than the citation itself.
+
+* hibtypes.el (org-link-outside-org-mode): Revert to pre-Stefan changes since 
not
+    yet integrating variable check instead of 'hyperb:stack-frame' calls.
+
 * hactypes.el (rfc-toc): Fix wrong 'select-buffer' call by replacing with
     'switch-to-buffer' for permanent return to original buffer.
 
diff --git a/hactypes.el b/hactypes.el
index e5d6465a20..bf7744d347 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:     25-Jun-23 at 09:38:34 by Bob Weiner
+;; Last-Mod:     25-Jun-23 at 13:48:01 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -36,9 +36,15 @@
   "Follow internal ref KEY within an annotated bibliography, delimiters=[]."
   (interactive "sReference key (no []): ")
   (let* ((key-regexp (concat "^[*]*[ \t]*\\[" (ebut:key-to-label key) "\\]"))
-        (citation (save-excursion
-                    (goto-char (point-max))
-                    (re-search-backward key-regexp nil t))))
+        (lbl-start (hattr:get 'hbut:current 'lbl-start))
+        (lbl-end (hattr:get 'hbut:current 'lbl-end))
+        (citation (when (and lbl-start lbl-end)
+                    (save-excursion
+                      (goto-char (point-max))
+                      (and (re-search-backward key-regexp nil t)
+                           (or (< (point) (1- lbl-start))
+                               (> (point) (1+ lbl-end)))
+                           (point))))))
     (if citation
        (progn (hpath:display-buffer (current-buffer))
               (goto-char citation)
diff --git a/hibtypes.el b/hibtypes.el
index 7f581d1ddf..a7136ad5db 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:     21-Jun-23 at 23:33:28 by Bob Weiner
+;; Last-Mod:     25-Jun-23 at 13:27:34 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -368,12 +368,11 @@ handle any links they recognize first."
             (not (funcall hsys-org-mode-function))
             ;; Prevent infinite recursion, e.g. if called via
             ;; `org-metareturn-hook' from `org-meta-return' invocation.
-            (not hibtypes--within-org-link-outside-org-mode))
+            (not (hyperb:stack-frame '(ibtypes::debugger-source 
org-meta-return))))
     (require 'hsys-org)
     (declare-function hsys-org-link-at-p      "hsys-org" ())
     (declare-function hsys-org-set-ibut-label "hsys-org" (start-end))
-    (let* ((hibtypes--within-org-link-outside-org-mode t)
-           (start-end (hsys-org-link-at-p)))
+    (let ((start-end (hsys-org-link-at-p)))
       (when start-end
         (hsys-org-set-ibut-label start-end)
         (hact #'org-open-at-point-global)))))
@@ -394,9 +393,14 @@ must have an attached file."
          (not (or (eq chr ?\ ) (eq chr ?*))))
        (not (or (derived-mode-p 'prog-mode)
                 (apply #'derived-mode-p '(c-mode objc-mode c++-mode java-mode 
markdown-mode org-mode))))
-       (let ((ref (hattr:get 'hbut:current 'lbl-key)))
+       (let ((ref (hattr:get 'hbut:current 'lbl-key))
+            (lbl-start (hattr:get 'hbut:current 'lbl-start)))
          (and ref (eq ?w (char-syntax (aref ref 0)))
               (not (string-match "[#@]" ref))
+             lbl-start
+             (save-excursion
+               (goto-char lbl-start)
+               (ibut:label-p t "[" "]" t))
               (hact 'annot-bib ref)))))
 
 ;;; ========================================================================



reply via email to

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