ggg
ggg

Reputation: 1979

How to indent a buffer in ESS?

ESS allows us to indent a line and an expression. Is there a key binding for indenting a buffer? If not, can we create it?

Upvotes: 3

Views: 1054

Answers (2)

kjfletch
kjfletch

Reputation: 5494

As stated by others you could mark the whole buffer C-x h and then indent the region with C-M-\

You could also put something along these lines in your .emacs file:

(defun my-indent-buffer()
  (interactive)
  (save-excursion
    (indent-region (point-min) (point-max))))

(global-set-key "\C-cib" 'my-indent-buffer)

This has the benefit of remembering your point.

Upvotes: 7

Dirk is no longer here
Dirk is no longer here

Reputation: 368439

Not sure about a buffer but you can mark a region and then use C-M-\ on it.

Upvotes: 6

Related Questions