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?
+4
A:
Not sure about a buffer but you can mark a region and then use C-M-\
on it.
Dirk Eddelbuettel
2010-05-28 03:24:53
Or mark the whole buffer with `C-x h`.
Nicholas Riley
2010-05-28 03:27:30
Ah. As always with Emacs, one learns something new every day. Or I guess one should. :)
Dirk Eddelbuettel
2010-05-28 14:48:18
+5
A:
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.
kjfletch
2010-05-28 09:45:23