Function: combobulate-cursor-edit-nodes
combobulate-cursor-edit-nodes is a natively compiled function defined
in combobulate-cursor.el.
Signature
(combobulate-cursor-edit-nodes NODES &optional DEFAULT-ACTION CTX-NODE)
Documentation
Interactively edit NODES optionally placed at DEFAULT-ACTION.
NODES is a list of nodes to edit, or a list of cons cells where the car
is the action to take and the cdr is the node to edit. Note that if
combobulate-cursor-tool is set to combobulate, the action is
disregarded.
DEFAULT-ACTION is the action to take if NODES is a list of nodes. For
multiple-cursors, the placement action (or DEFAULT-ACTION if the list
of NODES is not a list of cons cells) must be before, after, or
mark. For combobulate, the value is disregarded.
CTX-NODE is the node that was used to generate NODES, such as a parent node. It is only used for messaging.
Source Code
;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-cursor.el
(defun combobulate-cursor-edit-nodes (nodes &optional default-action ctx-node)
"Interactively edit NODES optionally placed at DEFAULT-ACTION.
NODES is a list of nodes to edit, or a list of cons cells where the car
is the action to take and the cdr is the node to edit. Note that if
`combobulate-cursor-tool' is set to `combobulate', the action is
disregarded.
DEFAULT-ACTION is the action to take if NODES is a list of nodes. For
`multiple-cursors', the placement action (or DEFAULT-ACTION if the list
of NODES is not a list of cons cells) must be `before', `after', or
`mark'. For `combobulate', the value is disregarded.
CTX-NODE is the node that was used to generate NODES, such as a
parent node. It is only used for messaging."
;; Determine if we are dealing with a list of nodes or list of cons
;; cells.
(let ((action-nodes
(if (and (listp nodes)
(not (consp (car nodes))))
(mapcar (lambda (node) (cons default-action node)) nodes)
;; action-nodes is a list of cons cells. So NODES must then
;; be turned into a flat list of nodes.
(prog1 nodes
(setq nodes (mapcar #'cdr nodes))))))
(cond ((= (length nodes) 0)
(combobulate-message "There are zero editable nodes."))
(t (combobulate-message
(concat "Editing " (combobulate-tally-nodes nodes t)
(and ctx-node (format " in `%s'"
(propertize
(combobulate-pretty-print-node ctx-node)
'face 'combobulate-active-indicator-face)))))))
(cond
((null nodes) (error "There are no editable nodes."))
((eq combobulate-cursor-tool 'combobulate)
(let ((proxy-nodes (combobulate-proxy-node-make-from-nodes nodes))
(combobulate-cursor--refactor-id (combobulate-refactor-setup))
(combobulate-cursor--active-buffer (current-buffer)))
(combobulate-refactor (:id combobulate-cursor--refactor-id)
;; Ditch the proxy nodes' text in the buffer and commit the
;; deletions immediately. The fields we insert will be the new
;; values.
(mapc #'mark-node-deleted proxy-nodes)
(commit)
;; Create new fields with the new values in the same places
;; as the old ones.
(mapc (lambda (node)
(mark-field (combobulate-node-start node)
combobulate-cursor--field-tag
(combobulate-node-text node)))
proxy-nodes)
(combobulate-envelope-prompt
(substitute-command-keys "Editing fields. Use \\`C-h' for help.")
nil
combobulate-cursor--active-buffer
(combobulate-cursor--update-function
combobulate-cursor--active-buffer
combobulate-cursor--field-tag)
combobulate-cursor-substitute-default
combobulate-cursor-key-map)
(commit))))
((eq combobulate-cursor-tool 'multiple-cursors)
(combobulate--mc-place-nodes action-nodes))
(t (error "Unknown cursor tool: %s" combobulate-cursor-tool)))))