# HG changeset patch # User Dan Nicolaescu # Date 1190656130 0 # Node ID f4b3c97a692feab4bec7d9973828e5a8de068cf2 # Parent 13a057bb5491f87c1a46c484f8be03658c695e62 * progmodes/cc-mode.el (c-mode-base-map): Use c-indent-line-or-region instead of c-indent-line. * indent.el (indent-for-tab-command): First check if the region is active. diff -r 13a057bb5491 -r f4b3c97a692f lisp/ChangeLog --- a/lisp/ChangeLog Mon Sep 24 15:26:47 2007 +0000 +++ b/lisp/ChangeLog Mon Sep 24 17:48:50 2007 +0000 @@ -1,3 +1,11 @@ +2007-09-24 Dan Nicolaescu + + * progmodes/cc-mode.el (c-mode-base-map): Use + c-indent-line-or-region instead of c-indent-line. + + * indent.el (indent-for-tab-command): First check if the region is + active. + 2007-09-24 Micha,Ak(Bl Cadilhac * whitespace.el (whitespace-tickle-timer): Don't install the timer if diff -r 13a057bb5491 -r f4b3c97a692f lisp/indent.el --- a/lisp/indent.el Mon Sep 24 15:26:47 2007 +0000 +++ b/lisp/indent.el Mon Sep 24 17:48:50 2007 +0000 @@ -88,6 +88,10 @@ `indent-line-function'." (interactive "P") (cond + ;; The region is active, indent it. + ((and transient-mark-mode mark-active + (not (eq (region-beginning) (region-end)))) + (indent-region (region-beginning) (region-end))) ((or ;; indent-to-left-margin is only meant for indenting, ;; so we force it to always insert a tab here. (eq indent-line-function 'indent-to-left-margin) @@ -99,10 +103,6 @@ ;; indenting, so we can't pass them to indent-according-to-mode. ((memq indent-line-function '(indent-relative indent-relative-maybe)) (funcall indent-line-function)) - ;; The region is active, indent it. - ((and transient-mark-mode mark-active - (not (eq (region-beginning) (region-end)))) - (indent-region (region-beginning) (region-end))) ;; Indent the line. (t (indent-according-to-mode)))) diff -r 13a057bb5491 -r f4b3c97a692f lisp/progmodes/cc-mode.el --- a/lisp/progmodes/cc-mode.el Mon Sep 24 15:26:47 2007 +0000 +++ b/lisp/progmodes/cc-mode.el Mon Sep 24 17:48:50 2007 +0000 @@ -269,7 +269,9 @@ 'c-indent-new-comment-line c-mode-base-map global-map) (substitute-key-definition 'indent-for-tab-command - 'c-indent-command + ;; XXX Is this the right thing to do + ;; here? + 'c-indent-line-or-region c-mode-base-map global-map) (when (fboundp 'comment-indent-new-line) ;; indent-new-comment-line has changed name to