aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDan Nicolaescu <[email protected]>2007-09-24 17:48:50 +0000
committerDan Nicolaescu <[email protected]>2007-09-24 17:48:50 +0000
commit17ee46255fade92111505295c38c29a0865f32ce (patch)
treefaeca187045aa9245efd8600944b3ec2603fea6a /lisp
parent9f7e1e6ed92f9c10c7f85fa60c24b0957875619f (diff)
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/indent.el8
-rw-r--r--lisp/progmodes/cc-mode.el4
3 files changed, 15 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c2d80dc064..c9875cfdcc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-24 Dan Nicolaescu <[email protected]>
+
+ * 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 <[email protected]>
* whitespace.el (whitespace-tickle-timer): Don't install the timer if
diff --git a/lisp/indent.el b/lisp/indent.el
index 2108b340f1..db8958bd1c 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -88,6 +88,10 @@ The function actually called to indent the line is determined by the value of
`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 @@ The function actually called to indent the line is determined by the value of
;; 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 --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8669a41c2f..f234404e81 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -269,7 +269,9 @@ control). See \"cc-mode.el\" for more info."
'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