Function: hyrolo-grep
hyrolo-grep is an autoloaded, interactive and byte-compiled function
defined in hyrolo.el.
Signature
(hyrolo-grep REGEXP &optional MAX-MATCHES HYROLO-FILES-OR-BUFS COUNT-ONLY HEADLINE-ONLY NO-DISPLAY)
Documentation
Display HyRolo entries matching REGEXP and return count of matches.
To a maximum of prefix arg MAX-MATCHES, in buffer(s) from
optional HYROLO-FILES-OR-BUFS or hyrolo-get-file-list. Default
is to find all matching entries. Each entry is displayed with
all of its sub-entries. Optional COUNT-ONLY non-nil means don't
retrieve and don't display matching entries. Optional
HEADLINE-ONLY searches only the first line of entries, not the
full text. Optional NO-DISPLAY non-nil retrieves entries but
does not display.
Nil value of MAX-MATCHES means find all entries that match, t value means find all matching entries but omit file headers, negative values mean find up to the inverse of that number of matching entries and omit file headers.
Return number of entries matched. See also documentation for the
variable hyrolo-file-list.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
;;;###autoload
(defun hyrolo-grep (regexp &optional max-matches hyrolo-files-or-bufs count-only headline-only no-display)
"Display HyRolo entries matching REGEXP and return count of matches.
To a maximum of prefix arg MAX-MATCHES, in buffer(s) from
optional HYROLO-FILES-OR-BUFS or `hyrolo-get-file-list'. Default
is to find all matching entries. Each entry is displayed with
all of its sub-entries. Optional COUNT-ONLY non-nil means don't
retrieve and don't display matching entries. Optional
HEADLINE-ONLY searches only the first line of entries, not the
full text. Optional NO-DISPLAY non-nil retrieves entries but
does not display.
Nil value of MAX-MATCHES means find all entries that match, t
value means find all matching entries but omit file headers,
negative values mean find up to the inverse of that number of
matching entries and omit file headers.
Return number of entries matched. See also documentation for the
variable `hyrolo-file-list'."
(interactive (let ((input-and-matching-files
(hyrolo-grep-input #'read-regexp
"Find rolo regular expression")))
(list (car input-and-matching-files)
current-prefix-arg
(mapcar #'expand-file-name
(cadr input-and-matching-files)))))
(unless (or (integerp max-matches) (memq max-matches '(nil t)))
(setq max-matches (prefix-numeric-value max-matches)))
(let ((files-or-bufs
(cond ((null hyrolo-files-or-bufs) (hyrolo-get-file-list))
((listp hyrolo-files-or-bufs) hyrolo-files-or-bufs)
((list hyrolo-files-or-bufs))))
(case-fold-search t)
(display-buf (unless count-only
(hyrolo-set-display-buffer)))
(total-matches 0)
(num-matched 0)
(inserting (or (eq max-matches t)
(and (integerp max-matches) (< max-matches 0))))
(file-or-buf))
(unless count-only
(setq buffer-read-only nil)
(unless inserting
(erase-buffer))
(hyrolo--cache-initialize))
(while (and (setq file-or-buf (car files-or-bufs))
(or (not (integerp max-matches))
(< total-matches (max max-matches (- max-matches)))))
(setq files-or-bufs (cdr files-or-bufs)
num-matched (cond ((and (featurep 'bbdb) (equal file-or-buf bbdb-file))
(hyrolo-bbdb-grep-file file-or-buf regexp max-matches count-only))
((and (hyrolo-google-contacts-p) (equal file-or-buf google-contacts-buffer-name))
(hyrolo-retrieve-google-contacts (regexp-quote regexp))
(hyrolo-google-contacts-grep-file file-or-buf regexp max-matches count-only))
(t (hyrolo-grep-file file-or-buf regexp max-matches count-only headline-only)))
total-matches (+ total-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 (= total-matches 0))
(hyrolo--post-display-buffer)
(unless (or no-display inserting)
(hyrolo-display-matches display-buf)))
(when (called-interactively-p 'interactive)
(message "%s matching entr%s found in HyRolo."
(if (= total-matches 0) "No" total-matches)
(if (= total-matches 1) "y" "ies")))
total-matches))