Function: ert-buffer-string-reindented

ert-buffer-string-reindented is a byte-compiled function defined in ert-x.el.gz.

Signature

(ert-buffer-string-reindented &optional BUFFER)

Documentation

Return the contents of BUFFER after reindentation.

BUFFER defaults to current buffer. Does not modify BUFFER.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
(defun ert-buffer-string-reindented (&optional buffer)
  "Return the contents of BUFFER after reindentation.

BUFFER defaults to current buffer.  Does not modify BUFFER."
  (with-current-buffer (or buffer (current-buffer))
    (let ((clone nil))
      (unwind-protect
          (progn
            ;; `clone-buffer' doesn't work if `buffer-file-name' is non-nil.
            (let ((buffer-file-name nil))
              (setq clone (clone-buffer)))
            (with-current-buffer clone
              (let ((inhibit-read-only t))
                (indent-region (point-min) (point-max)))
              (buffer-string)))
        (when clone
          (let ((kill-buffer-query-functions nil))
            (kill-buffer clone)))))))