From: Richard M. Stallman Date: Tue, 25 Dec 2007 22:14:07 +0000 (+0000) Subject: (c-indent-line-or-region): X-Git-Tag: emacs-pretest-23.0.90~8844 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c02a1ee94d36e39d5bae3a22086b9e4e48b4fe37;p=emacs.git (c-indent-line-or-region): Pass prefix arg to `c-indent-command'. Use `use-region-p'. --- diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 06c0946290b..2b80f455e55 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -3069,16 +3069,17 @@ non-nil." ;; compiled, e.g. in the menus. (c-region-is-active-p)) -(defun c-indent-line-or-region () - "When the region is active, indent it syntactically. Otherwise -indent the current line syntactically." - ;; Emacs has a variable called mark-active, XEmacs uses region-active-p - (interactive) - (if (and transient-mark-mode mark-active - (not (eq (region-beginning) (region-end)))) +(defun c-indent-line-or-region (&optional arg region) + "Indent active region, current line, or block starting on this line. +In Transient Mark mode, when the region is active, reindent the region. +Othewise, with a prefix argument, rigidly reindent the expression +starting on the current line. +Otherwise reindent just the current line." + (interactive + (list current-prefix-arg (use-region-p))) + (if region (c-indent-region (region-beginning) (region-end)) - (c-indent-line))) - + (c-indent-command arg))) ;; for progress reporting (defvar c-progress-info nil)