Function: combobulate-highlight-dwim-at-point

combobulate-highlight-dwim-at-point is an interactive and natively compiled function defined in combobulate-query.el.

Signature

(combobulate-highlight-dwim-at-point FACE STRICT)

Documentation

DWIM and build a query that highlight nodes with FACE.

If STRICT is non-nil, then the parent node of the node at point is used to constrain the search. Otherwise, the parent node is marked _ indicating a wildcard.

Uses context-nodes to determine the right node at point to highlight.

Key Bindings

combobulate-highlight-key-map h combobulate-key-map C-c o h h combobulate-options-key-map h h

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-query.el
(defun combobulate-highlight-dwim-at-point (face strict)
  "DWIM and build a query that highlight nodes with FACE.

If STRICT is non-nil, then the parent node of the node at point
is used to constrain the search.  Otherwise, the parent node is
marked `_' indicating a wildcard.

Uses `context-nodes' to determine the right
node at point to highlight."
  (interactive (list (combobulate-highlight-read-face-name "Face: ")
                     (y-or-n-p "Match similar types only? ")))
  ;; determine the right node at point to collect.
  (let ((node (with-navigation-nodes (:procedures (combobulate-read context-nodes))
                (car-safe
                 (seq-sort #'combobulate-node-larger-than-node-p
                           (seq-filter #'combobulate-navigable-node-p
                                       (cons (combobulate-node-at-point nil t)
                                             (combobulate-get-parents (combobulate-node-at-point nil t))))))))
        (query))
    (unless node (error "Cannot find a valid context node at point"))
    (with-navigation-nodes (:procedures (combobulate-read procedures-hierarchy))
      (if-let ((node-parent (combobulate-node-parent node)))
          (progn
            (setq query (combobulate-query-builder-matcher-query
                         node
                         (combobulate-query-builder-get-node-text node)
                         strict
                         face
                         node-parent))
            (combobulate-query-builder-install-into-buffer
             (current-buffer)
             query
             (combobulate-parser-language (combobulate-parser-node node)))
            (combobulate-message
             (format "Installing %s query:\n %s"
                     (if strict "strict" "lax")
                     (combobulate-query-builder-fontify-query query (combobulate-parser-node node)))))
        (error "Cannot derive a parent node from the current node")))))