emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/indent.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/indent.el,v
Date: Sat, 22 Sep 2007 00:57:01 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   07/09/22 00:57:00

Index: lisp/indent.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/indent.el,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- lisp/indent.el      26 Jul 2007 05:26:26 -0000      1.68
+++ lisp/indent.el      22 Sep 2007 00:56:59 -0000      1.69
@@ -78,11 +78,13 @@
     (funcall indent-line-function)))
 
 (defun indent-for-tab-command (&optional arg)
-  "Indent line in proper way for current major mode or insert a tab.
+  "Indent line or region in proper way for current major mode or insert a tab.
 Depending on `tab-always-indent', either insert a tab or indent.
 If initial point was within line's indentation, position after
 the indentation.  Else stay at same point in text.
-The function actually called to indent is determined by the value of
+If `transient-mark-mode' is turned on the region is active,
+indent the region.
+The function actually called to indent the line is determined by the value of
 `indent-line-function'."
   (interactive "P")
   (cond
@@ -97,7 +99,12 @@
    ;; 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))
-   (t ;; The normal case.
+   ;; 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))))
 
 (defun insert-tab (&optional arg)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]