Function: combobulate-query-builder-copy-node-hierarchy-at-point

combobulate-query-builder-copy-node-hierarchy-at-point is an interactive and natively compiled function defined in combobulate-query.el.

Signature

(combobulate-query-builder-copy-node-hierarchy-at-point)

Documentation

Select a node hierarchy starting at point and copy it into the query builder.

Key Bindings

combobulate-query-mode-map C-c h

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-query.el
(defun combobulate-query-builder-copy-node-hierarchy-at-point ()
  "Select a node hierarchy starting at point and copy it into the query builder."
  (interactive)
  (combobulate-query-builder-live-or-error)
  (with-current-buffer combobulate-query-builder-target-buffer-name
    (let* ((point-node (combobulate-node-at-point nil t))
           (parent-node
            (combobulate-proffer-choices
             (cons point-node (combobulate-get-parents point-node))
             #'combobulate-proffer-action-highlighter
             :prompt-description "Pick a node hierarchy to copy")))
      (unless parent-node
        (user-error "No node selected"))
      ;; check if we have a `node' slot in the parent
      ;; node. `combobulate-proffer-choices' only returns proxy nodes.
      (setq parent-node (combobulate-proxy-node-node parent-node))
      (combobulate-query-builder-insert
       (combobulate-query-builder-to-string
        (combobulate-build-nested-query
         (cons point-node
               (combobulate-get-parents-until point-node parent-node))))))))