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 INTERACTIVE-FLAG)
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. Optional INTERACTIVE-FLAG treats this as an
interactive call.
MAX-MATCHES values are the following:
1. nil - find all entries that match;
2. t - find all matching entries, omit file headers,
don't erase the match buffer before adding entries,
and don't display the match buffer;
3. negative value - find up to the inverse of that number of
matching entries.
Return the number of entries matched. See also documentation for the
variable hyrolo-file-list.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hyrolo.el
;;;###autoload
(defun hyrolo-grep (regexp &optional max-matches hyrolo-files-or-bufs count-only headline-only no-display interactive-flag)
"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. Optional INTERACTIVE-FLAG treats this as an
interactive call.
MAX-MATCHES values are the following:
1. nil - find all entries that match;
2. t - find all matching entries, omit file headers,
don't erase the match buffer before adding entries,
and don't display the match buffer;
3. negative value - find up to the inverse of that number of
matching entries.
Return the 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))
nil nil nil t)))
(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
(when interactive-flag
(default-value 'hyrolo-display-buffer)))))
(total-matches 0)
(num-matched 0)
(inserting (eq max-matches t))
(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 display-buf)
(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))