[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole f38a8dd 28/50: Fix Hyrolo logicial searches;
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole f38a8dd 28/50: Fix Hyrolo logicial searches; bug fixes; handle file:// URLs better |
Date: |
Wed, 17 Mar 2021 18:44:18 -0400 (EDT) |
branch: externals/hyperbole
commit f38a8dd8afd785279ec98cd71f624a9e1c0869dc
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Fix Hyrolo logicial searches; bug fixes; handle file:// URLs better
dir-summary ibtype - fix to leave point in file activated by Action Key
---
Changes | 41 +++++++++++++++++++++++++++++------------
hbut.el | 7 ++++---
hibtypes.el | 23 ++++++++++++-----------
hpath.el | 3 ++-
hyrolo-demo.el | 16 +++++++++++++---
hyrolo-logic.el | 35 +++++++++++++++++++++++++----------
hyrolo.el | 23 +++++++++--------------
7 files changed, 94 insertions(+), 54 deletions(-)
diff --git a/Changes b/Changes
index 312f75f..74d4657 100644
--- a/Changes
+++ b/Changes
@@ -1,14 +1,32 @@
+2021-02-07 Bob Weiner <rsw@gnu.org>
+
+* hibtypes.el (dir-summary): Fixed so point is left in file displayed by
action key press, not the MANIFEST.
+
+* hpath.el (hpath:delimited-possible-path): Added support for file:// URLs.
+
+2021-01-31 Bob Weiner <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-display-format-function): Separated records by 1 newline,
not 2; unsure how 2 were ever added.
+ (hyrolo-fgrep):
+ hyrolo-logic.el (hyrolo-fgrep-logical, hyrolo-map-logic):
+ hyrolo-demo.el (hyrolo-demo-fgrep-logical): Changed default to not show full
hierarchy of records but just
+ matching sub-levels, for more intuitive logical expression matching. Made
rolo-logical searches in DEMO work.
+
+2020-12-03 Bob Weiner <rsw@gnu.org>
+
+* hibtypes.el (Info-node): Allowed for backslash double-quotes around node
name, e.g. when in a doc string.
+
2020-11-22 Bob Weiner <rsw@gnu.org>
-* hpath.el (hpath:trim): Fix to not trim trailing quoted double quote,
+* hpath.el (hpath:trim): Fixed to not trim trailing quoted double quote,
resolving bug#43644.
-* hibtypes.el (mail-address): If mail-address-mode-list is set to nil,
- activate this ibtype in any major mode.
+* hibtypes.el (mail-address): When mail-address-mode-list is set to nil,
+ activated this ibtype in any major mode.
2020-11-16 Bob Weiner <rsw@gnu.org>
-* kotl/kexport.el (kexport:html): Lowercase HTML tags for HTML5.
+* kotl/kexport.el (kexport:html): Lowercased HTML tags for HTML5.
2020-11-08 Bob Weiner <rsw@gnu.org>
@@ -19,14 +37,6 @@
* hibtypes.el (man-apropos): Prevented matches to log lines like:
WARNING: (func-name) - warning description
-<<<<<<< Updated upstream
-2020-11-02 Mats Lidell <matsl@gnu.org>
-
-* hpath.el (hpath:external-display-alist-mswindows):
- (hpath:internal-display-alist): Add customization.
- (hpath:external-display-alist-x): Add customization. Use
- xdg-open to use users preferred app in window system.
-=======
2020-11-07 Bob Weiner <rsw@gnu.org>
* kotl/kotl-mode.el (kotl-mode:copy-absolute-klink-to-kill-ring):
@@ -41,6 +51,13 @@
(kcell-view:absolute-reference): Added for kcell references with
absolute paths.
+2020-11-02 Mats Lidell <matsl@gnu.org>
+
+* hpath.el (hpath:external-display-alist-mswindows):
+ (hpath:internal-display-alist): Add customization.
+ (hpath:external-display-alist-x): Add customization. Use
+ xdg-open to use users preferred app in window system.
+
2020-11-01 Bob Weiner <rsw@gnu.org>
* hbut.el (ebut:program): Added a programmatic way to create explicit buttons.
diff --git a/hbut.el b/hbut.el
index 85bef7a..92a84e7 100644
--- a/hbut.el
+++ b/hbut.el
@@ -1729,14 +1729,15 @@ type for ibtype is presently undefined."
"Create a new Hyperbole link type whose buttons look like:
<LINK-TYPE-SYMBOL text>
where text is regexp grouping 1 (\\1) that may be substituted into
LINK-REGEXP. Activation of such buttons either executes a
- brace-delimited key series, displays a URL or displays a path."
+brace-delimited key series, displays a URL or displays a path."
`(ibtype:create-from-regexp ,link-type-symbol "<" ">" (format "%s
\"?\\([^\t\n\r\f'`\"]+\\)\"?" ',link-type-symbol)
,link-regexp))
(defmacro ibtype:create-from-regexp (ibtype-symbol start-delim end-delim
text-regexp link-regexp &optional start-regexp-flag end-regexp-flag)
"Create a new Hyperbole implicit button type from: IBTYPE-SYMBOL,
START-DELIM and END-DELIM (strings), TEXT-REGEXP and LINK-REGEXP.
-With optional START-REGEXP-FLAG non-nil, START-DELIM is treated as a
-regular expression. END-REGEXP-FLAG is similar. "
+With optional START-REGEXP-FLAG non-nil, START-DELIM is treated
+as a regular expression. END-REGEXP-FLAG treats END-DELIM as a
+regular expression. "
`(prog1
(defib ,ibtype-symbol ()
(interactive)
diff --git a/hibtypes.el b/hibtypes.el
index 0c15aff..903bdec 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -571,17 +571,17 @@ spaces and then another non-space, non-parenthesis,
non-brace character."
(when buffer-file-name
(let ((file (file-name-nondirectory buffer-file-name))
entry start end)
- (when (or (string-equal file "DIR")
- (string-match "\\`MANIFEST\\(\\..+\\)?\\'" file))
- (save-excursion
- (beginning-of-line)
- (when (looking-at "\\(;+[ \t]*\\)?\\([^(){}* \t\n\r]+\\)")
- (setq entry (match-string-no-properties 2)
- start (match-beginning 2)
- end (match-end 2))
- (when (file-exists-p entry)
- (ibut:label-set entry start end)
- (hact 'link-to-file entry))))))))
+ (when (and (or (string-equal file "DIR")
+ (string-match "\\`MANIFEST\\(\\..+\\)?\\'" file))
+ (save-excursion
+ (beginning-of-line)
+ (when (looking-at "\\(;+[ \t]*\\)?\\([^(){}* \t\n\r]+\\)")
+ (setq entry (match-string-no-properties 2)
+ start (match-beginning 2)
+ end (match-end 2))
+ (file-exists-p entry))))
+ (ibut:label-set entry start end)
+ (hact 'link-to-file entry)))))
;;; ========================================================================
;;; Handles Gnu debbugs issue ids, e.g. bug#45678 or just 45678.
@@ -1188,6 +1188,7 @@ 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)
+ (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 781f34a..533d04b 100644
--- a/hpath.el
+++ b/hpath.el
@@ -777,7 +777,8 @@ With optional INCLUDE-POSITIONS, returns a triplet list of
(path start-pos
end-pos) or nil."
;; Prevents MSWindows to Posix path substitution
(let ((hyperb:microsoft-os-p t))
- (or (hargs:delimited "\"" "\"" nil nil include-positions "[`'’]")
+ (or (hargs:delimited "file://" "\\s-" nil t include-positions)
+ (hargs:delimited "\"" "\"" nil nil include-positions "[`'’]")
;; Filenames in Info docs or Python files
(hargs:delimited "[`'‘]" "[`'’]" t t include-positions "\"")
;; Filenames in TexInfo docs
diff --git a/hyrolo-demo.el b/hyrolo-demo.el
index 96b03ba..ff039c0 100644
--- a/hyrolo-demo.el
+++ b/hyrolo-demo.el
@@ -47,8 +47,16 @@ logical expression matching."
(hyrolo-fgrep string max-matches)))
;;;###autoload
-(defun hyrolo-demo-fgrep-logical (expr)
+(defun hyrolo-demo-fgrep-logical (expr &optional count-only
include-sub-entries no-sub-entries-out)
"Display rolo entries in \"DEMO-ROLO.otl\" matching EXPR which may contain
prefix logical operators.
+If optional COUNT-ONLY is non-nil, don't display entries, return
+count of matching entries only. If optional INCLUDE-SUB-ENTRIES
+flag is non-nil, SEXP will be applied across all sub-entries at
+once. Default is to apply SEXP to each entry and sub-entry
+separately. Entries are displayed with all of their sub-entries
+unless INCLUDE-SUB-ENTRIES is nil and optional NO-SUB-ENTRIES-OUT
+flag is non-nil.
+
A complex example of EXPR might be:
(and (or (not time card) (xor (french balloons) spanish)) teacher pet)
which means:
@@ -60,9 +68,11 @@ which means:
Either double quotes or parentheses may be used to group multiple words as a
single argument."
- (interactive "sLogical rolo search: ")
+ (interactive "sLogical rolo search: \nP\nP")
+ (when (called-interactively-p 'any)
+ (setq no-sub-entries-out (not no-sub-entries-out)))
(let ((hyrolo-file-list (list (expand-file-name "DEMO-ROLO.otl"
hyperb:dir))))
- (hyrolo-fgrep-logical expr)))
+ (hyrolo-fgrep-logical expr count-only include-sub-entries
no-sub-entries-out)))
(defun hyrolo-demo-quit ()
"Remove the code in this file."
diff --git a/hyrolo-logic.el b/hyrolo-logic.el
index ba0f392..cead68e 100644
--- a/hyrolo-logic.el
+++ b/hyrolo-logic.el
@@ -26,6 +26,9 @@
;; might be:
;; (and (or (not time card) (xor "french balloons" spanish)) teacher
pet)
;;
+;; By default, only sub-entries with matches are shown, not entire
+;; hierarchies of entries, for more intuitive results. Use a prefix
argument
+;;
;; Either double quotes or parentheses may be used to group multiple
;; words as a single argument.
;;
@@ -67,8 +70,16 @@
;;; ************************************************************************
;;;###autoload
-(defun hyrolo-fgrep-logical (expr)
- "Display rolo entries matching EXPR which may contain prefix logical
operators.
+(defun hyrolo-fgrep-logical (expr &optional count-only include-sub-entries
no-sub-entries-out)
+ "Display rolo entries matching EXPR, a string, which may contain prefix
logical operators.
+If optional COUNT-ONLY is non-nil, don't display entries, return
+count of matching entries only. If optional INCLUDE-SUB-ENTRIES
+flag is non-nil, SEXP will be applied across all sub-entries at
+once. Default is to apply SEXP to each entry and sub-entry
+separately. Entries are displayed with all of their sub-entries
+unless INCLUDE-SUB-ENTRIES is nil and optional NO-SUB-ENTRIES-OUT
+flag is non-nil.
+
A complex example of EXPR might be:
(and (or (not time card) (xor (and french balloons) spanish)) teacher pet)
which means:
@@ -80,7 +91,9 @@ which means:
Either double quotes or parentheses may be used to group multiple words as a
single argument."
- (interactive "sLogical rolo search: ")
+ (interactive "sLogical rolo search: \nP\nP")
+ (when (called-interactively-p 'any)
+ (setq no-sub-entries-out (not no-sub-entries-out)))
(let* ((case-fold-search t)
(total-matches))
(if (not (string-match "\(\\(and\\|or\\|xor\\|not\\)\\>" expr))
@@ -109,7 +122,8 @@ single argument."
(setq expr (hypb:replace-match-string "\(@ " expr "\(hyrolo-xor " t))
(setq expr (hypb:replace-match-string "\(! " expr "\(hyrolo-not " t))
(setq expr (hypb:replace-match-string "\(& " expr "\(hyrolo-and " t))
- (setq expr (format "(hyrolo-logic (quote %s) nil nil t)" expr))
+ (setq expr (format "(hyrolo-logic (quote %s) nil count-only %s %s)"
+ expr include-sub-entries no-sub-entries-out))
(setq total-matches (eval (read expr))))
(if (called-interactively-p 'interactive)
(message "%s matching entr%s found in rolo."
@@ -149,7 +163,7 @@ SEXP that matched entries."
total-matches))))
(defun hyrolo-map-logic (sexp hyrolo-buf &optional count-only
- include-sub-entries no-sub-entries-out)
+ include-sub-entries no-sub-entries-out)
"Apply logical SEXP to each entry in HYROLO-BUF and write out matching
entries to `hyrolo-display-buffer'.
If optional COUNT-ONLY is non-nil, don't display entries, return count of
matching entries only. If optional INCLUDE-SUB-ENTRIES flag is non-nil, SEXP
@@ -210,11 +224,12 @@ of applications of SEXP that matched entries."
(if result
(progn (goto-char end)
(setq num-found (1+ num-found)
- end (if (or include-sub-entries
- no-sub-entries-out)
- end
- (goto-char (hyrolo-to-entry-end
- t
curr-entry-level-len))))
+ )
+ ;; end (if (or include-sub-entries
+ ;; no-sub-entries-out)
+ ;; end
+ ;; (goto-char
(hyrolo-to-entry-end
+ ;; t
curr-entry-level-len))))
(or count-only
(append-to-buffer display-buf start end)))
(goto-char end-entry-hdr)))))))
diff --git a/hyrolo.el b/hyrolo.el
index 1a48061..579a967 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -51,9 +51,8 @@ See documentation of the function `format-time-string' for
format options."
:group 'hyperbole-rolo)
(defvar hyrolo-display-format-function
- ;; Set trailing newlines to exactly two.
(lambda (entry)
- (concat (replace-regexp-in-string "[ \t\n\r]+\\'" "" entry nil t) "\n\n"))
+ (concat (replace-regexp-in-string "[ \t\n\r]+\\'" "" entry nil t) "\n"))
"*Function of one argument, a rolo entry string, which modifies the string
for display.")
(defcustom hyrolo-email-format "%s\t\t<%s>"
@@ -375,9 +374,9 @@ the logical expression matching."
(let ((total-matches
(if (string-match "\(\\(and\\|or\\|xor\\|not\\)\\>" string)
;; Search string contains embedded logic operators.
- (hyrolo-fgrep-logical string)
+ (hyrolo-fgrep-logical string count-only nil t)
(hyrolo-grep (regexp-quote string) max-matches
- hyrolo-file count-only no-display))))
+ hyrolo-file count-only no-display))))
(if (called-interactively-p 'interactive)
(message "%s matching entr%s found in rolo."
(if (= total-matches 0) "No" total-matches)
@@ -502,8 +501,7 @@ Return t if entry is killed, nil otherwise."
(setq buffer-read-only nil)
(re-search-backward hyrolo-entry-regexp nil t)
(setq end (match-end 0))
- (beginning-of-line)
- (setq start (point)
+ (setq start (line-beginning-position)
level-len (length (buffer-substring-no-properties start
end)))
(goto-char end)
(skip-chars-forward " \t")
@@ -1403,9 +1401,8 @@ Return point where matching entry begins or nil if not
found."
(not (save-excursion
(beginning-of-line)
(setq found
- (if (looking-at
- (concat hyrolo-entry-regexp (regexp-quote
name)))
- (point))))))))
+ (when (looking-at (concat hyrolo-entry-regexp
(regexp-quote name)))
+ (point))))))))
(unless found
(hyrolo-kill-buffer))) ;; conditionally kill
(widen)
@@ -1417,8 +1414,8 @@ Return point where matching entry begins or nil if not
found."
(defun hyrolo-to-entry-end (&optional include-sub-entries curr-entry-level-len)
"Move point to the end of the whole entry that point is within if optional
INCLUDE-SUB-ENTRIES is non-nil.
-CURR-ENTRY-LEVEL-LEN is a the integer length of the last found entry
-header. If INCLUDE-SUB-ENTRIES is nil, CURR-ENTRY-LEVEL-LEN is not needed.
+CURR-ENTRY-LEVEL-LEN is the integer length of the last entry
+header found. If INCLUDE-SUB-ENTRIES is nil, CURR-ENTRY-LEVEL-LEN is not
needed.
Return current point."
;; Sets free variable, next-entry-exists, for speed.
(while (and (setq next-entry-exists
@@ -1427,9 +1424,7 @@ Return current point."
;; Prevents including trailing whitespace in entry level
;; length which in turn causes moving to (point-max).
(goto-char (match-end hyrolo-entry-group-number))
- (> (- (point) (save-excursion
- (beginning-of-line)
- (point)))
+ (> (- (point) (line-beginning-position))
curr-entry-level-len)))
(if next-entry-exists
(progn (beginning-of-line) (point))
- [elpa] externals/hyperbole e3544c8 23/50: Revert improper application of "Use \\0 for matched Nth substitution", (continued)
- [elpa] externals/hyperbole e3544c8 23/50: Revert improper application of "Use \\0 for matched Nth substitution", Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole f1b2cba 24/50: Add dependency on hvar to resolve use of var:remove-all (#43), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 312c858 25/50: kexport.el - use lowercase HTML tags; mail-address ibtype allow trigger in any major mode, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole a3b9d6d 26/50: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 398f8e4 32/50: Add hypb:def-to-buffer to hypb.el for fast def copying, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole a831ef9 36/50: Fix bug #46606 by replacing hkey-define-key with hkey-global-set-key, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 8969fe9 43/50: Merge branch 'master' of hyperbole, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole c8947dd 47/50: Merge branch 'master' of hyperbole, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole db73cf7 19/50: Use \0 for matched Nth substitution (see also commit #c0e48fb3), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 1826307 27/50: Resolve bug#43644 where final double quote was trimmed from strings., Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole f38a8dd 28/50: Fix Hyrolo logicial searches; bug fixes; handle file:// URLs better,
Stefan Monnier <=
- [elpa] externals/hyperbole 3469ea3 29/50: Release defil and defal simpler implicit button type create macros, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 6a8154a 33/50: Add first unit tests (#46), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole a44b392 34/50: Add UNIX shell error implicit button support, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole aa6f2f6 38/50: Verify error message from hpath:find is correct (#50), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole aad4494 40/50: Add smart-magit-tab: Do what TAB or RET does, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole d1dcd54 41/50: * Disable magit-auto-revert-mode-enable-in-buffers in hyrolo buffer, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole c7d62e1 46/50: Make defil handle action type symbols and strings, Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 6b2c073 49/50: Correct test cases failing on mac (#55), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 4eef4e9 50/50: Install with-simulated-input if not available (#54), Stefan Monnier, 2021/03/17
- [elpa] externals/hyperbole 25ba634 31/50: Add fast window link button creation via {M-o w} with Ace Window., Stefan Monnier, 2021/03/17