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

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

[elpa] externals/hyperbole ce82b18 5/6: Fix bug#47909: Update regexes an


From: ELPA Syncer
Subject: [elpa] externals/hyperbole ce82b18 5/6: Fix bug#47909: Update regexes and hyrolo-grep calls so doc-ids work
Date: Wed, 21 Apr 2021 00:57:09 -0400 (EDT)

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

    Fix bug#47909: Update regexes and hyrolo-grep calls so doc-ids work
---
 Changes       | 18 ++++++++++++++++++
 hib-doc-id.el | 30 ++++++++++++++++--------------
 hyrolo.el     | 30 ++++++++++++++----------------
 3 files changed, 48 insertions(+), 30 deletions(-)

diff --git a/Changes b/Changes
index 3cfff72..e09f292 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,23 @@
 2021-04-20  Bob Weiner  <rsw@gnu.org>
 
+* Makefile (tests, all-tests): Add these target aliases.
+
+* hui-mouse.el (hkey-alist): Move smart-magit-mode handling to a higher 
priority
+    than Hyperbole button handling so implicit pathname buttons don't trigger.
+    This makes behavior across magit lines consistent and pathnames can still
+    be displayed using the Assist Key (invokes magit {RET} key).
+
+* hyrolo.el (hyrolo-to-entry-end): Default to using entire hyrolo-entry-regexp
+    to determine the outline depth when no hyrolo-entry-group-number is
+    included in the expression.  Fixes issue that could call (goto-char nil).
+
+* hib-doc-id.el (doc-id-online-regexp): Tighten matching to disallow any type
+    of whitespace besides spaces within the document link.
+                (link-to-doc, doc-id:help): Fix bug in hyrolo-grep call not
+    using 'no-display argument causing invalid return type.
+                (doc-id-p): Regexp-quote delimiters and allow for whitespace
+    within them.
+
 * kotl/kotl-autoloads.el: Remove reference to unreleased kexport-menu.el
     to fix bug#47916.
 
diff --git a/hib-doc-id.el b/hib-doc-id.el
index 9d17b0e..5e34e24 100644
--- a/hib-doc-id.el
+++ b/hib-doc-id.el
@@ -4,7 +4,7 @@
 ;;
 ;; Orig-Date:    30-Sep-92 at 19:39:59
 ;;
-;; Copyright (C) 1991-2016  Free Software Foundation, Inc.
+;; Copyright (C) 1991-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
@@ -32,9 +32,9 @@
 ;;   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
-;;   brackets, starting with a topic name, followed by a - and a
-;;   multi-digit numeric identifier.
+;;   The default setup uses doc ids of the form, [- Emacs-001 -], delimited
+;;   by minus signs inside square brackets, the id starting with a topic name,
+;;   followed by a minus sign and a multi-digit numeric identifier.
 ;;
 ;;   Typically an index entry should have links to all available forms of its
 ;;   document, e.g. online, printed, source.  Below is a sample index entry 
form
@@ -42,7 +42,7 @@
 ;;   you prefer a different one, you must change all of the variable values.
 ;;
 ;;  --------------------------------------------------------------------------
-;;  Title:                                                  ID: []
+;;  Title:                                                  ID: [- -]
 ;;  Email-To:
 ;;  Distribution:     
 ;;  
@@ -84,13 +84,15 @@
 (defvar doc-id-end   "-]"
   "String which delimits end of a site-specific document id.")
 
-(defvar doc-id-index-entry-regexp "^------+[ \t\n\r]+Title:"
+(defvar doc-id-index-entry-regexp "^------+\\s-+Title:"
   "Regexp which matches start of a site-specific document index entry.")
 
 (defvar doc-id-match
   (lambda (doc-id)
-    (concat "ID:[ \t]*\\[" (regexp-quote doc-id) "\\]"))
-  "Function which returns regexp which matches only in DOC-ID's index entry.")
+    (concat "ID:[ \t]*"
+           (regexp-quote doc-id-start) "[ \t]*" (regexp-quote doc-id)
+           "[ \t]*" (regexp-quote doc-id-end)))
+  "Function of one argument that returns regexp which matches only within 
DOC-ID's index entry.")
 
 (defvar doc-id-p (lambda (str)
                   (and (stringp str)
@@ -99,8 +101,8 @@
                        (string-match "\\`\\w+-[0-9][0-9][0-9]+\\'" str)))
   "Value is a function with a boolean result that tests whether `str' is a doc 
id.")
 
-(defvar doc-id-online-regexp "^Online-Loc:[ \t]*\"\\([^\"]+\\)\""
-  "Regexp whose 1st grouping matches an implicit button which displays an 
online document within an index entry.")
+(defvar doc-id-online-regexp "^Online-Loc:[ \t]*\"\\([^\"\t\r\n\f]+\\)\""
+  "Regexp whose 1st grouping matches a double quoted index entry implicit 
button that displays an online document.")
 
 ;;; ************************************************************************
 ;;; Public implicit button types
@@ -121,7 +123,7 @@ an error."
           (error "(doc-id-index-entry): You must set the `doc-id-indices' 
variable first"))
          ((let ((hyrolo-entry-regexp doc-id-index-entry-regexp))
             (zerop (hyrolo-grep (funcall doc-id-match doc-id)
-                              1 doc-id-indices nil 'no-display)))
+                                1 doc-id-indices nil 'no-display)))
           (error "(doc-id-index-entry): %s not found in document index"
                  delim-doc-id))
          ;; Matching index entry has been put into `hyrolo-display-buffer'.
@@ -131,8 +133,7 @@ an error."
               (if (re-search-forward doc-id-online-regexp nil t)
                   (progn
                     (goto-char (match-beginning 1))
-                    (let ((doc-path (buffer-substring
-                                     (match-beginning 1) (match-end 1)))
+                    (let ((doc-path (match-string 1))
                           (ibut (ibut:at-p)))
                       (if ibut
                           (progn (hbut:act ibut)
@@ -175,7 +176,8 @@ Also display standard Hyperbole help for implicit button 
BUT."
        (doc-id (hbut:key-to-label (hattr:get but 'lbl-key))))
     (cond ((null doc-id-indices)
           (error "(doc-id-index-entry): You must set the `doc-id-indices' 
variable first"))
-         ((zerop (hyrolo-grep (funcall doc-id-match doc-id) 1 doc-id-indices))
+         ((zerop (hyrolo-grep (funcall doc-id-match doc-id) 1 doc-id-indices
+                              nil 'no-display))
           (error
             "(doc-id-index-entry): No document index entry found for %s%s%s"
                  doc-id-start doc-id doc-id-end)))
diff --git a/hyrolo.el b/hyrolo.el
index 8989bb4..18e4188 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -296,7 +296,7 @@ Second arg RETURN-TO-BUFFER is the buffer to leave point 
within after the displa
 
 ;;;###autoload
 (defun hyrolo-edit (&optional name file)
-  "Edits a rolo entry given by optional NAME within `hyrolo-file-list'.
+  "Edit a rolo entry given by optional NAME within `hyrolo-file-list'.
 With prefix argument, prompts for optional FILE to locate entry within.
 With no NAME arg, simply displays FILE or first entry in `hyrolo-file-list' in 
an
 editable mode.  NAME may be of the form: parent/child to edit child below a
@@ -397,7 +397,7 @@ but omit file headers, negative values mean find up to the 
inverse of that
 number of entries and omit file headers.
 
 Return number of entries matched.  See also documentation for the variable
-hyrolo-file-list."
+\`hyrolo-file-list'."
   (interactive "sFind rolo regular expression: \nP")
   (unless (or (integerp max-matches) (memq max-matches '(nil t)))
     (setq max-matches (prefix-numeric-value max-matches)))
@@ -406,15 +406,14 @@ hyrolo-file-list."
               ((listp hyrolo-file-or-bufs) hyrolo-file-or-bufs)
               ((list hyrolo-file-or-bufs))))
        (case-fold-search t)
-       (display-buf (if count-only
-                        nil
+       (display-buf (unless count-only
                       (set-buffer (get-buffer-create hyrolo-display-buffer))))
        (total-matches 0)
        (num-matched 0)
        (inserting (or (eq max-matches t)
                       (and (integerp max-matches) (< max-matches 0))))
        (file))
-    (if count-only nil
+    (unless count-only
       (setq buffer-read-only nil)
       (or inserting (erase-buffer)))
     (while (and (setq file (car hyrolo-file-list))
@@ -428,18 +427,17 @@ hyrolo-file-list."
                               (hyrolo-google-contacts-grep-file file regexp 
max-matches count-only))
                              (t (hyrolo-grep-file file regexp max-matches 
count-only)))
            total-matches (+ total-matches num-matched))
-      (if (integerp max-matches)
-         (setq max-matches
-               (if (>= max-matches 0)
-                   (- max-matches num-matched)
-                 (+ max-matches num-matched)))))
+      (when (integerp max-matches)
+       (setq max-matches
+             (if (>= max-matches 0)
+                 (- max-matches num-matched)
+               (+ max-matches num-matched)))))
     (unless (or count-only no-display inserting (= total-matches 0))
       (hyrolo-display-matches display-buf))
-    (if (called-interactively-p 'interactive)
-       (message "%s matching entr%s found in rolo."
-                (if (= total-matches 0) "No" total-matches)
-                (if (= total-matches 1) "y" "ies")
-                ))
+    (when (called-interactively-p 'interactive)
+      (message "%s matching entr%s found in rolo."
+              (if (= total-matches 0) "No" total-matches)
+              (if (= total-matches 1) "y" "ies")))
     total-matches))
 
 (defun hyrolo-isearch (&optional arg)
@@ -1427,7 +1425,7 @@ Return current point."
              include-sub-entries
              ;; Prevents including trailing whitespace in entry level
              ;; length which in turn causes moving to (point-max).
-             (goto-char (match-end hyrolo-entry-group-number))
+             (goto-char (or (match-end hyrolo-entry-group-number) (match-end 
0)))
              (> (- (point) (line-beginning-position))
                 curr-entry-level-len)))
   (if next-entry-exists



reply via email to

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