Function: backward-delete-char-untabify
backward-delete-char-untabify is an interactive and byte-compiled
function defined in simple.el.gz.
Signature
(backward-delete-char-untabify ARG &optional KILLP)
Documentation
Delete characters backward, changing tabs into spaces.
The exact behavior depends on backward-delete-char-untabify-method.
Delete ARG chars, and kill (save in kill ring) if KILLP is non-nil.
If Transient Mark mode is enabled, the mark is active, and ARG is 1,
delete the text in the region and deactivate the mark instead.
To disable this, set option delete-active-region(var)/delete-active-region(fun) to nil.
Interactively, ARG is the prefix arg (default 1) and KILLP is t if a prefix arg was specified.
Probably introduced at or before Emacs version 21.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun backward-delete-char-untabify (arg &optional killp)
"Delete characters backward, changing tabs into spaces.
The exact behavior depends on `backward-delete-char-untabify-method'.
Delete ARG chars, and kill (save in kill ring) if KILLP is non-nil.
If Transient Mark mode is enabled, the mark is active, and ARG is 1,
delete the text in the region and deactivate the mark instead.
To disable this, set option `delete-active-region' to nil.
Interactively, ARG is the prefix arg (default 1)
and KILLP is t if a prefix arg was specified."
(interactive "*p\nP")
(when (eq backward-delete-char-untabify-method 'untabify)
(let ((count arg))
(save-excursion
(while (and (> count 0) (not (bobp)))
(if (= (preceding-char) ?\t)
(let ((col (current-column)))
(forward-char -1)
(setq col (- col (current-column)))
(insert-char ?\s col)
(delete-char 1)))
(forward-char -1)
(setq count (1- count))))))
(let* ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t")
((eq backward-delete-char-untabify-method 'all)
" \t\n\r")))
(n (if skip
(let* ((oldpt (point))
(wh (- oldpt (save-excursion
(skip-chars-backward skip)
(constrain-to-field nil oldpt)))))
(+ arg (if (zerop wh) 0 (1- wh))))
arg)))
;; Avoid warning about delete-backward-char
(with-no-warnings (delete-backward-char n killp))))