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

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

[elpa] externals/hyperbole 4085c60953 3/5: limit hyrolo-grep-file backwa


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 4085c60953 3/5: limit hyrolo-grep-file backward search
Date: Fri, 1 Dec 2023 09:58:14 -0500 (EST)

branch: externals/hyperbole
commit 4085c609533876689b4a50a8bc42b733bf867f51
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    limit hyrolo-grep-file backward search
    
    When inserting Hyperbole logo into files like FAST-DEMO, leave
    first line of option settings that starts with -*- as first line.
---
 ChangeLog      |  10 ++++++
 hbut.el        |  22 ++++++++-----
 hui-select.el  |   7 ++--
 hypb.el        |   8 +++--
 hyrolo-demo.el |  11 +++++--
 hyrolo.el      | 101 ++++++---------------------------------------------------
 6 files changed, 51 insertions(+), 108 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 229c1bfe18..39f7e57ced 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-11-30  Bob Weiner  <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-grep-file): Add 'backward-search-limit' to minimize
+    backward searches to the end of the last match and to prevent
+    forward search stalls in some contexts.
+
+* hypb.el (hypb:insert-hyperbole-banner): Keep any initial line of
+    variable settings (starts with -*-, e.g. for Org mode as the first
+    line.
+
 2023-11-30  Mats Lidell  <matsl@gnu.org>
 
 * test/hui-tests.el (hui--ebut-link-directly-to-file)
diff --git a/hbut.el b/hbut.el
index e1be5606d5..0833e3481e 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,11 +3,11 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     30-Nov-23 at 23:20:52 by Bob Weiner
+;; Last-Mod:     30-Nov-23 at 23:23:53 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
-;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
+;; Copyright (C) 1991-2023  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
@@ -1503,16 +1503,16 @@ non-nil)."
     (nreverse result)))
 
 (defvar   hbut:syntax-table (copy-syntax-table emacs-lisp-mode-syntax-table)
-  "Modified Elisp syntax table for use with Action and Key Series buttons.
-Makes < > and { } into syntactically matching pairs after `hyperb:init'
+  "Syntax table copied from Elisp for use with Action and Key Series buttons.
+Make < > and { } into syntactically matching pairs after `hyperb:init'
 calls `hbut:modify-syntax'.")
 
 ;;;###autoload
 (defun    hbut:modify-syntax ()
   "Make <> and {} behave as syntactic character pairs in major syntax tables.
-Modify `hbut:syntax-table', `help-mode-syntax-table',`text-mode-syntax-table',
-and `fundamental-mode's syntax table.  For use with implicit button
-activations."
+Modify `hbut:syntax-table' and `help-mode-syntax-table' to include <> and {}.
+Modify `text-mode-syntax-table' and `fundamental-mode's syntax table
+to include {} only.  For use with implicit button activations."
   ;; Treat angle brackets and braces as opening and closing delimiters
   ;; for ease  of matching.
   (mapc (lambda (syntax-table)
@@ -1521,8 +1521,12 @@ activations."
          ;; Treat braces as opening and closing delimiters for ease of 
matching.
          (modify-syntax-entry ?\{ "(}" syntax-table)
          (modify-syntax-entry ?\} "){" syntax-table))
-       (list hbut:syntax-table help-mode-syntax-table
-             text-mode-syntax-table
+       (list hbut:syntax-table help-mode-syntax-table))
+  (mapc (lambda (syntax-table)
+         ;; Treat braces as opening and closing delimiters for ease of 
matching.
+         (modify-syntax-entry ?\{ "(}" syntax-table)
+         (modify-syntax-entry ?\} "){" syntax-table))
+       (list text-mode-syntax-table
              ;; fundamental-mode syntax table
              (standard-syntax-table)))
   nil)
diff --git a/hui-select.el b/hui-select.el
index 3fabbb358e..612a7c00ba 100644
--- a/hui-select.el
+++ b/hui-select.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Oct-96 at 02:25:27
-;; Last-Mod:     23-Nov-23 at 03:07:22 by Bob Weiner
+;; Last-Mod:     30-Nov-23 at 11:33:09 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -432,8 +432,8 @@ Also, add language-specific syntax setups to aid in thing 
selection."
                                  `(lambda ()
                                      (let ((syntax-table (symbol-value 
',syntax-table-sym))
                                            (keymap (symbol-value 
',keymap-sym)))
-                                      (modify-syntax-entry ?\< "(>" 
syntax-table)
-                                      (modify-syntax-entry ?\> ")<" 
syntax-table)
+                                      ;; (modify-syntax-entry ?\< "(>" 
syntax-table)
+                                      ;; (modify-syntax-entry ?\> ")<" 
syntax-table)
                                       (modify-syntax-entry ?\{ "(}" 
syntax-table)
                                       (modify-syntax-entry ?\} "){" 
syntax-table)
                                       (modify-syntax-entry ?\" "\"" 
syntax-table)
@@ -541,6 +541,7 @@ displayed in the minibuffer."
 ;;;###autoload
 (defun hui-select-goto-matching-tag ()
   "Move point to start of the tag paired with closest tag point is at or 
precedes.
+Tag in this context is an sgml-like tag surrounded by angle brackets, <>.
 Enabled in major modes in `hui-select-markup-modes'.  Returns t if
 point is moved, else nil.  Signals an error if no tag is found
 following point or if the closing tag does not have a `>'
diff --git a/hypb.el b/hypb.el
index b9c66eb126..fc649dcc0e 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:     20-Nov-23 at 00:49:09 by Bob Weiner
+;; Last-Mod:     30-Nov-23 at 11:18:54 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1069,9 +1069,13 @@ Without file, the banner is prepended to the current 
buffer."
             (buffer-read-only)
             button)
        (goto-char (point-min))
+       ;; Keep any initial line of variable settings, e.g. for Org
+       ;; mode as the first line.
+       (when (looking-at (regexp-quote "-*- "))
+         (forward-line 1))
        (insert "\n")
        (insert-image hyperbole-banner)
-       (insert "\n\n")
+       (insert "\n")
        (setq button (make-button (- (point) 3) (- (point) 2) :type 
'hyperbole-banner))
        (button-put button 'help-echo (concat "Click to visit " hypb:home-page))
        (button-put button 'action #'hypb:browse-home-page)
diff --git a/hyrolo-demo.el b/hyrolo-demo.el
index 3cf72ff26e..41f19fbc7a 100644
--- a/hyrolo-demo.el
+++ b/hyrolo-demo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     4-Nov-17 at 13:56:47
-;; Last-Mod:      7-Oct-22 at 00:16:24 by Mats Lidell
+;; Last-Mod:     30-Nov-23 at 11:55:28 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -46,8 +46,13 @@ Returns number of entries matched.  See also documentation 
for
 the function `hyrolo-demo-fgrep-logical' for documentation on the
 logical sexpression matching."
   (interactive "sFind rolo string (or logical sexpression): \nP")
-  (let ((hyrolo-file-list (list (expand-file-name "DEMO-ROLO.otl" 
hyperb:dir))))
-    (hyrolo-fgrep string max-matches)))
+  (let* ((hyrolo-file-list (list (expand-file-name "DEMO-ROLO.otl" 
hyperb:dir)))
+        (match-count (hyrolo-fgrep string max-matches)))
+    (when (and (called-interactively-p 'interactive)
+              (zerop match-count))
+      ;; Let user know that they invoked the demo version of hyrolo-fgrep
+      (message "(hyrolo-demo-fgrep): No demo matches found for '%s'" string))
+    match-count))
 
 ;;;###autoload
 (defun hyrolo-demo-fgrep-logical (expr &optional count-only 
include-sub-entries no-sub-entries-out)
diff --git a/hyrolo.el b/hyrolo.el
index 347d2d95ab..a8bb8d011e 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Jun-89 at 22:08:29
-;; Last-Mod:     30-Nov-23 at 23:21:05 by Bob Weiner
+;; Last-Mod:     30-Nov-23 at 23:31:44 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -335,10 +335,7 @@ String search expressions are converted to regular 
expressions.")
 
 (if hyrolo-mode-syntax-table
     ()
-  (setq hyrolo-mode-syntax-table (make-syntax-table text-mode-syntax-table))
-  ;; Support syntactic selection of delimited e-mail addresses.
-  (modify-syntax-entry ?\<  "(>" hyrolo-mode-syntax-table)
-  (modify-syntax-entry ?\>  ")<" hyrolo-mode-syntax-table))
+  (setq hyrolo-mode-syntax-table (make-syntax-table text-mode-syntax-table)))
 
 (defvar hyrolo-mode-map nil
   "Keymap for the hyrolo match buffer.")
@@ -1683,14 +1680,17 @@ Return number of matching entries found."
                      (when (re-search-forward hyrolo-hdr-regexp nil t 2)
                        (forward-line)
                        (setq hdr-pos (cons (point-min) (point))))
-                     (let ((case-fold-search t)
-                           match-end)
+                     (let* ((case-fold-search t)
+                            (backward-search-limit (if (re-search-forward 
hyrolo-entry-regexp nil t)
+                                                       (match-beginning 0)
+                                                     (point)))
+                            match-end)
                        (re-search-forward hyrolo-entry-regexp nil t)
                        (while (and (or (null max-matches) (< num-found 
max-matches))
                                    (funcall hyrolo-next-match-function pattern 
headline-only))
                          (setq match-end (point))
                          ;; If no entry delimiters found, just return the line 
of the match alone.
-                         (unless (re-search-backward hyrolo-entry-regexp nil t)
+                         (unless (re-search-backward hyrolo-entry-regexp 
backward-search-limit t)
                            (goto-char (line-beginning-position)))
                          (setq entry-start (point))
                          (unless (re-search-forward hyrolo-entry-regexp nil t)
@@ -1729,7 +1729,8 @@ Return number of matching entries found."
                                  (set-buffer actual-buf))))
                          (setq num-found (1+ num-found))
                          (or count-only
-                             (hyrolo-add-match hyrolo-display-buffer pattern 
entry-start (point)))))))
+                             (hyrolo-add-match hyrolo-display-buffer pattern 
entry-start (point)))
+                         (setq backward-search-limit (point))))))
                  num-found))
          (when (< stuck-negative-point 0)
            (pop-to-buffer (current-buffer))
@@ -2278,88 +2279,6 @@ trailing periods and whitespace."
   (or (cdr (assoc (match-string 0) outline-heading-alist))
       (1- (- (match-end 0) (match-beginning 0)))))
 
-<<<<<<< HEAD
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hyrolo--expanded-file-list nil
-  "List of hyrolo files after directory and file wildcard expansions.
-Hyrolo sets this internally; never set it yourself.")
-
-(defvar hyrolo-entry-group-number 1
-  "Group number whose length represents the level of any entry matched.
-See `hyrolo-entry-regexp'")
-
-(defvar hyrolo-entry-trailing-space-group-number 2
-  "Group number within `hyrolo-entry-regexp; containing trailing space.")
-
-(defconst hyrolo-hdr-format
-  (concat
-   
"===============================================================================\n"
-   "%s\n"
-   
"===============================================================================\n")
-  "Header to insert preceding a file's first hyrolo entry match when
-file has none of its own.  Used with one argument, the file name.")
-
-(defconst hyrolo-hdr-regexp "^==="
-  "Regular expression to match the first and last lines of hyrolo file headers.
-This header is inserted into hyrolo-display-buffer before any entries from the
-file are added.")
-
-(defconst hyrolo-match-regexp nil
-  "Last regular expression used to search the hyrolo.
-Nil before a search is done, including after a logical search is done.
-String search expressions are converted to regular expressions.")
-
-(defvar hyrolo--wconfig nil
-  "Saves frame's window configuration prior to a hyrolo search.")
-
-(defvar hyrolo-mode-syntax-table nil
-  "Syntax table used while in hyrolo match mode.")
-
-(if hyrolo-mode-syntax-table
-    ()
-  (setq hyrolo-mode-syntax-table (make-syntax-table text-mode-syntax-table)))
-
-(defvar hyrolo-mode-map nil
-  "Keymap for the hyrolo match buffer.")
-
-(if hyrolo-mode-map
-    nil
-  (setq hyrolo-mode-map (make-keymap))
-  (if (fboundp 'set-keymap-name)
-      (set-keymap-name hyrolo-mode-map 'hyrolo-mode-map))
-  (suppress-keymap hyrolo-mode-map)
-  (define-key hyrolo-mode-map ","        'hyrolo-to-entry-beginning)
-  (define-key hyrolo-mode-map "."        'hyrolo-to-entry-end)
-  (define-key hyrolo-mode-map "<"        'beginning-of-buffer)
-  (define-key hyrolo-mode-map ">"        'end-of-buffer)
-  (define-key hyrolo-mode-map "?"        'describe-mode)
-  (define-key hyrolo-mode-map "\177"     'scroll-down)
-  (define-key hyrolo-mode-map " "        'scroll-up)
-  (define-key hyrolo-mode-map "a"        'outline-show-all)
-  (define-key hyrolo-mode-map "b"        'hyrolo-backward-same-level)
-  (define-key hyrolo-mode-map "e"        'hyrolo-edit-entry)
-  (define-key hyrolo-mode-map "f"        'hyrolo-forward-same-level)
-  (define-key hyrolo-mode-map "h"        'hyrolo-hide-subtree)
-  (define-key hyrolo-mode-map "l"        'hyrolo-locate)
-  (define-key hyrolo-mode-map "m"        'hyrolo-mail-to)
-  (define-key hyrolo-mode-map "n"        'hyrolo-next-visible-heading)
-  (define-key hyrolo-mode-map "o"        'hyrolo-overview)
-  (define-key hyrolo-mode-map "p"        'hyrolo-previous-visible-heading)
-  (define-key hyrolo-mode-map "q"        'hyrolo-quit)
-  (define-key hyrolo-mode-map "r"        'hyrolo-grep-or-fgrep)
-  (define-key hyrolo-mode-map "s"        'outline-show-subtree)
-  (define-key hyrolo-mode-map "\M-s"     'hyrolo-isearch)
-  (define-key hyrolo-mode-map "t"        'hyrolo-top-level)
-  (define-key hyrolo-mode-map "\C-i"     'hyrolo-next-match)      ;; {TAB}
-  (define-key hyrolo-mode-map "\M-\C-i"  'hyrolo-previous-match)  ;; {M-TAB}
-  (define-key hyrolo-mode-map [backtab]  'hyrolo-previous-match)  ;; 
{Shift-TAB}
-  (define-key hyrolo-mode-map "u"        'hyrolo-up-heading))
-
-=======
->>>>>>> master
 (provide 'hyrolo)
 
 ;;; hyrolo.el ends here



reply via email to

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