Commit 9df4ec5e authored by Leo Liu's avatar Leo Liu

* simple.el (prog-indent-sexp): Indent enclosing defun.

parent 5ebfa896
2013-05-16 Leo Liu <sdl.web@gmail.com>
* simple.el (prog-indent-sexp): Indent enclosing defun.
2013-05-15 Glenn Morris <rgm@gnu.org>
* cus-start.el (show-trailing-whitespace): Move to editing basics.
......
......@@ -380,12 +380,18 @@ Other major modes are defined by comparison with this one."
map)
"Keymap used for programming modes.")
(defun prog-indent-sexp ()
"Indent the expression after point."
(interactive)
(let ((start (point))
(end (save-excursion (forward-sexp 1) (point))))
(indent-region start end nil)))
(defun prog-indent-sexp (&optional defun)
"Indent the expression after point.
When interactively called with prefix, indent the enclosing defun
instead."
(interactive "P")
(save-excursion
(when defun
(end-of-line)
(beginning-of-defun))
(let ((start (point))
(end (progn (forward-sexp 1) (point))))
(indent-region start end nil))))
(define-derived-mode prog-mode fundamental-mode "Prog"
"Major mode for editing programming language source code."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment