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

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

[elpa] externals/hyperbole f55679b 4/4: Small fixes for mail ibuttons, O


From: ELPA Syncer
Subject: [elpa] externals/hyperbole f55679b 4/4: Small fixes for mail ibuttons, Org interface, and doc-ids
Date: Tue, 20 Apr 2021 00:57:08 -0400 (EDT)

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

    Small fixes for mail ibuttons, Org interface, and doc-ids
    
    * hsys-org.el (hsys-org-link-at-p): Change to use org-link-bracket-re so 
match
        includes the second display part of an Org link and matches whole link
        expression.
                  (hsys-org-radio-target-def-at-p): Change org-linked-text
        property to newer, org-target to properly match radio targets.
                  (hsys-org-radio-target-link-at-p): Correct and simplify.
    
    * hib-doc-id.el: Changed to use "[-" and "-]" delimiters because "[" and "]"
        are too common and mistakenly match to part of Org links.
    
    * hibtypes.el (mail-address-regexp): Resolve bug#4788, allow first char in
        address to be a digit.
---
 Changes       | 13 +++++++++++++
 hib-doc-id.el | 23 ++++++++++++-----------
 hibtypes.el   |  2 +-
 hsys-org.el   | 19 ++++++++++---------
 4 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/Changes b/Changes
index 8cd7992..493eb07 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,18 @@
 2021-04-19  Bob Weiner  <rsw@gnu.org>
 
+* hsys-org.el (hsys-org-link-at-p): Change to use org-link-bracket-re so match
+    includes the second display part of an Org link and matches whole link
+    expression.
+              (hsys-org-radio-target-def-at-p): Change org-linked-text
+    property to newer, org-target to properly match radio targets.
+              (hsys-org-radio-target-link-at-p): Correct and simplify.
+
+* hib-doc-id.el: Changed to use "[-" and "-]" delimiters because "[" and "]"
+    are too common and mistakenly match to part of Org links.
+
+* hibtypes.el (mail-address-regexp): Resolve bug#4788, allow first char in
+    address to be a digit.
+
 * hib-debbugs.el (debbugs-version-sufficient-p): No-op when debbugs package
     not found
 
diff --git a/hib-doc-id.el b/hib-doc-id.el
index 0fb3a69..9d17b0e 100644
--- a/hib-doc-id.el
+++ b/hib-doc-id.el
@@ -14,11 +14,12 @@
 ;;  This library defines the `doc-id' implicit button type which lets
 ;;  you create archives of reference documents by topic and then
 ;;  reference them within any Hyperbole readable file by use of simple
-;;  identifiers, like [Emacs-001].
+;;  identifiers, like [-Emacs-001-].  It functions like a rapid access
+;;  card catalog with easy to embed document identifiers.
 ;;
 ;;  TO USE:
 ;;
-;;   Pressing the Action Key on a doc id such as, [Emacs-001],
+;;   Pressing the Action Key on a doc id such as, [-Emacs-001-],
 ;;   displays the online version of the document, if any.  Pressing the
 ;;   Assist Key on it displays its document index entry.
 ;;
@@ -31,7 +32,7 @@
 ;;   You must explicitly load this library in order to use it, since
 ;;   Hyperbole does not load it by default.
 ;;
-;;   The default setup uses doc ids of the form, [Emacs-001], delimited by
+;;   The default setup uses doc ids of the form, [-Emacs-001-], delimited by
 ;;   brackets, starting with a topic name, followed by a - and a
 ;;   multi-digit numeric identifier.
 ;;
@@ -78,9 +79,9 @@
 ;;; Private variables
 ;;; ************************************************************************
 
-(defvar doc-id-start "["
+(defvar doc-id-start "[-"
   "String which delimits start of a site-specific document id.")
-(defvar doc-id-end   "]"
+(defvar doc-id-end   "-]"
   "String which delimits end of a site-specific document id.")
 
 (defvar doc-id-index-entry-regexp "^------+[ \t\n\r]+Title:"
@@ -146,12 +147,12 @@ an error."
   "Display a document from a local document library given its id.
 Ids must be delimited by `doc-id-start' and `doc-id-end' and must
 match the function stored in `doc-id-p'."
-  (and (not (bolp))
-       (let* ((id-and-pos (hbut:label-p t doc-id-start doc-id-end t))
-             (id (car id-and-pos)))
-        (if (funcall doc-id-p id)
-            (progn (ibut:label-set id-and-pos)
-                   (hact 'link-to-doc id))))))
+  (unless (bolp)
+    (let* ((id-and-pos (hbut:label-p t doc-id-start doc-id-end t))
+          (id (car id-and-pos)))
+      (when (funcall doc-id-p id)
+       (ibut:label-set id-and-pos)
+       (hact 'link-to-doc id)))))
 
 ;;; ************************************************************************
 ;;; Public variables
diff --git a/hibtypes.el b/hibtypes.el
index adbac96..34444b5 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -70,7 +70,7 @@
   "Regular expression of most common Internet top level domain names.")
 
 (defconst mail-address-regexp
-  
"\\([_a-zA-Z][-_a-zA-Z0-9.!@+%]*@[-_a-zA-Z0-9.!@+%]+\\.[a-zA-Z0-9][-_a-zA-Z0-9]+\\)\\($\\|[^a-zA-Z0-9@%]\\)"
+  
"\\([_a-zA-Z0-9][-_a-zA-Z0-9.!@+%]*@[-_a-zA-Z0-9.!@+%]+\\.[a-zA-Z0-9][-_a-zA-Z0-9]+\\)\\($\\|[^a-zA-Z0-9@%]\\)"
   "Regexp with group 1 matching an Internet email address.")
 
 ;;; ************************************************************************
diff --git a/hsys-org.el b/hsys-org.el
index 5521e26..a4e1d66 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -91,11 +91,13 @@
 
 (defun hsys-org-link-at-p ()
   "Return non-nil iff point is on an Org mode link.
-Assumes caller has already checked that the current buffer is in `org-mode'."
-  (or (if (boundp 'org-link-any-re)
-         (org-in-regexp org-link-any-re)
-       (org-in-regexp org-any-link-re))
-      (hsys-org-face-at-p 'org-link)))
+Assumes caller has already checked that the current buffer is in `org-mode'
+or are looking for an Org link in another buffer type."
+  (cond ((boundp 'org-link-bracket-re)
+        (org-in-regexp org-link-bracket-re))
+       ((boundp 'org-bracket-link-regexp)
+        (org-in-regexp org-bracket-link-regexp))
+       (t (hsys-org-face-at-p 'org-link))))
 
 ;; Assumes caller has already checked that the current buffer is in org-mode.
 (defun hsys-org-target-at-p ()
@@ -105,9 +107,8 @@ Assumes caller has already checked that the current buffer 
is in `org-mode'."
 
 (defun hsys-org-radio-target-link-at-p ()
   "Return (target-start . target-end) positions iff point is on an Org mode 
radio target link (referent), else nil."
-  (and (get-text-property (point) 'org-linked-text)
-       (hsys-org-link-at-p)
-       (hsys-org-region-with-text-property-value (point) 'org-linked-text)))
+  (and (hsys-org-face-at-p 'org-link)
+       (hsys-org-link-at-p)))
 
 (defun hsys-org-radio-target-def-at-p ()
   "Return (target-start . target-end) positions iff point is on an Org mode 
radio target (definition), including any delimiter characters, else nil."
@@ -117,7 +118,7 @@ Assumes caller has already checked that the current buffer 
is in `org-mode'."
        (goto-char (or (previous-single-property-change (point) 'face) 
(point-min))))
       (when (looking-at "<<<")
        (goto-char (match-end 0)))
-      (and (get-text-property (point) 'org-linked-text)
+      (and (hsys-org-face-at-p 'org-target)
           (hsys-org-region-with-text-property-value (point) 'face)))))
 
 (defun hsys-org-radio-target-at-p ()



reply via email to

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