Function: hyrolo-fgrep-logical
hyrolo-fgrep-logical is an autoloaded, interactive and byte-compiled
function defined in hyrolo-logic.el.
Signature
(hyrolo-fgrep-logical EXPR &optional COUNT-ONLY INCLUDE-SUB-ENTRIES NO-SUB-ENTRIES-OUT KOUTLINE-FLAG)
Documentation
Display rolo entries matching EXPR.
EXPR is a string that may contain sexpression logical prefix 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. With optional KOUTLINE-FLAG, map entries with
hyrolo-map-kotl rather than hyrolo-map-entries.
A complex example of EXPR might be:
(and
(or (not time card) (xor (and french "red balloons") spanish))
teacher
pet)
which means:
(Match neither time nor card
or
Match exactly one of (french and red balloons) or (spanish))
and
must include the terms teacher as well as pet to match.
Double quotes may be used to group multiple words as a single argument.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo-logic.el
;;; ************************************************************************
;;; Public functions
;;; ************************************************************************
;;;###autoload
(defun hyrolo-fgrep-logical (expr &optional count-only include-sub-entries
no-sub-entries-out koutline-flag)
"Display rolo entries matching EXPR.
EXPR is a string that may contain sexpression logical prefix 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. With optional KOUTLINE-FLAG, map entries with
`hyrolo-map-kotl' rather than `hyrolo-map-entries'.
A complex example of EXPR might be:
(and
(or (not time card) (xor (and french \"red balloons\") spanish))
teacher
pet)
which means:
(Match neither `time' nor `card'
or
Match exactly one of (`french' and `red balloons') or (`spanish'))
and
must include the terms `teacher' as well as `pet' to match.
Double quotes may be used to group multiple words as a single argument."
(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))
(cond (koutline-flag
(setq expr (format "(hyrolo-logic (quote %S) nil %s %s %s %s)"
(read expr) count-only include-sub-entries
no-sub-entries-out t))
(setq total-matches (eval (read expr))))
((string-match-p hyrolo-logical-regexp expr)
(setq expr (replace-regexp-in-string "(or " "(| " expr nil t))
(setq expr (replace-regexp-in-string "(xor " "(@ " expr nil t))
(setq expr (replace-regexp-in-string "(not " "(! " expr nil t))
(setq expr (replace-regexp-in-string "(and " "(& " expr nil t))
(setq expr (replace-regexp-in-string "(r-or " "(r-| " expr nil t))
(setq expr (replace-regexp-in-string "(r-xor " "(r-@ " expr nil t))
(setq expr (replace-regexp-in-string "(r-not " "(r-! " expr nil t))
(setq expr (replace-regexp-in-string "(r-and " "(r-& " expr nil t))
(setq expr (replace-regexp-in-string
"\"\\([^\"]*\\)\"" "{\\1}" expr nil nil))
(let ((saved-expr expr))
(while
(not (equal
saved-expr
(setq expr (replace-regexp-in-string
"\\(\\s-\\)\\([^{}()\" \t\n\r]+\\)\\([^{}()]*\\([()]\\|\\s-\\)\\)"
"\\1\"\\2\"\\3" expr nil nil))))
(setq saved-expr expr)))
(setq expr (replace-regexp-in-string
"{\\([^{}]+\\)}" "\"\\1\"" expr nil nil))
(setq expr (replace-regexp-in-string "(| " "(hyrolo-or start end " expr nil t))
(setq expr (replace-regexp-in-string "(@ " "(hyrolo-xor start end " expr nil t))
(setq expr (replace-regexp-in-string "(! " "(hyrolo-not start end " expr nil t))
(setq expr (replace-regexp-in-string "(& " "(hyrolo-and start end " expr nil t))
(setq expr (replace-regexp-in-string "(r-| " "(hyrolo-r-or start end " expr nil t))
(setq expr (replace-regexp-in-string "(r-@ " "(hyrolo-r-xor start end " expr nil t))
(setq expr (replace-regexp-in-string "(r-! " "(hyrolo-r-not start end " expr nil t))
(setq expr (replace-regexp-in-string "(r-& " "(hyrolo-r-and start end " expr nil t))
(setq expr (format "(hyrolo-logic (quote %S) nil %s %s %s %s)"
(read expr) count-only include-sub-entries
no-sub-entries-out koutline-flag))
(setq total-matches (eval (read expr))))
(t
;; Search string does not contain embedded logic
;; operators; do a string search instead.
(setq total-matches (hyrolo-fgrep expr))))
(if (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))