Function: yaml-electric-backspace

yaml-electric-backspace is an interactive and natively compiled function defined in yaml-mode.el.

Signature

(yaml-electric-backspace ARG)

Documentation

Delete characters or back-dent the current line.

If invoked following only whitespace on a line, will back-dent to the immediately previous multiple of yaml-indent-offset spaces.

Key Bindings

yaml-mode-map DEL

Source Code

;; Defined in /nix/store/fxfawcfn8g3mqnf4q0lmvgvy0vp3nxrx-emacs-packages-deps/share/emacs/site-lisp/elpa/yaml-mode-20260830.2340/yaml-mode.el
(defun yaml-electric-backspace (arg)
  "Delete characters or back-dent the current line.
If invoked following only whitespace on a line, will back-dent to the
immediately previous multiple of `yaml-indent-offset' spaces."
  (interactive "*p")
  (if (or (/= (current-indentation) (current-column)) (bolp))
      (funcall yaml-backspace-function arg)
    (let ((ci (current-column)))
      (beginning-of-line)
      (delete-horizontal-space)
      (indent-to (* (/ (- ci (* arg yaml-indent-offset))
                       yaml-indent-offset)
                    yaml-indent-offset)))))