Function: combobulate-procedure-try
combobulate-procedure-try is a natively compiled function defined in
combobulate-procedure.el.
Signature
(combobulate-procedure-try PROCEDURE NODE)
Documentation
Apply PROCEDURE to NODE and return the result, if any.
See combobulate-procedure-apply for more information on how to write a
PROCEDURE.
Source Code
;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-procedure.el
(defun combobulate-procedure-try (procedure node)
"Apply PROCEDURE to NODE and return the result, if any.
See `combobulate-procedure-apply' for more information on how to write a
PROCEDURE."
(let ((procedure-result))
(setq procedure-result (combobulate-procedure-apply procedure node))
(pcase procedure-result
('nil nil)
((cl-struct combobulate-procedure-result
matched-selection
selected-nodes)
;; We define a successful result as one of the following:
;;
;; Either the matched selection is `n/a', indicating that there
;; were no `:selector' properties to further refine the
;; activated nodes.
;;
;; Or the matched selection is `t' *and* that there is at least
;; one selected node with a `@match' or `match' tag.
(when (or (eq matched-selection 'n/a)
(and (eq matched-selection t)
(seq-find (pcase-lambda (`(,mark . ,_))
(or (eq mark '@match) (eq mark 'match)))
selected-nodes)))
(when combobulate-debug (combobulate-procedure-debug-print-result procedure-result))
procedure-result))
(_ (error "Unknown procedure result `%s'" procedure-result)))))