Function: kill-ring-deindent-buffer-substring-function
kill-ring-deindent-buffer-substring-function is a byte-compiled
function defined in indent-aux.el.gz.
Signature
(kill-ring-deindent-buffer-substring-function BEG END DELETE)
Documentation
Save the text within BEG and END to kill-ring, decreasing indentation.
Delete the saved text if DELETE is non-nil.
In the saved copy of the text, remove some of the indentation, such that the buffer position at BEG will be at column zero when the text is yanked.
Source Code
;; Defined in /usr/src/emacs/lisp/indent-aux.el.gz
;; Indent Filter mode. When enabled, this minor mode filters all
;; killed text to remove leading indentation.
(defun kill-ring-deindent-buffer-substring-function (beg end delete)
"Save the text within BEG and END to kill-ring, decreasing indentation.
Delete the saved text if DELETE is non-nil.
In the saved copy of the text, remove some of the indentation, such
that the buffer position at BEG will be at column zero when the text
is yanked."
(let ((a beg)
(b end))
(setq beg (min a b)
end (max a b)))
(let ((indentation (save-excursion (goto-char beg)
(current-column)))
(i-t-m indent-tabs-mode)
(text (if delete
(delete-and-extract-region beg end)
(buffer-substring beg end))))
(with-temp-buffer
;; We bind inhibit-read-only non-nil in case the copied text has
;; read-only properties.
(let ((inhibit-read-only t))
;; Indent/deindent the same as the major mode in the original
;; buffer.
(setq indent-tabs-mode i-t-m)
(insert text)
(indent-rigidly (point-min) (point-max)
(- indentation))
(buffer-string)))))