Function: yaml-electric-dash-and-dot

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

Signature

(yaml-electric-dash-and-dot ARG)

Documentation

Insert the bound key and possibly de-dent line.

Inserts the bound key. If inserting the bound key causes the current line to match a document delimiter, de-dent the line to the left margin.

Key Bindings

yaml-mode-map - yaml-mode-map .

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-dash-and-dot (arg)
  "Insert the bound key and possibly de-dent line.
Inserts the bound key.  If inserting the bound key causes the current
line to match a document delimiter, de-dent the line to the left
margin."
  (interactive "*P")
  (self-insert-command (prefix-numeric-value arg))
  (save-excursion
    (beginning-of-line)
    (when (and (not arg) (looking-at yaml-document-delimiter-re))
      (delete-horizontal-space))))