Mercurial > emacs
comparison lisp/indent.el @ 84840:f4b3c97a692f
* 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.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Mon, 24 Sep 2007 17:48:50 +0000 |
parents | d8b9b78eb16c |
children | 3664514f5c60 14c4a6aac623 |
comparison
equal
deleted
inserted
replaced
84839:13a057bb5491 | 84840:f4b3c97a692f |
---|---|
86 indent the region. | 86 indent the region. |
87 The function actually called to indent the line is determined by the value of | 87 The function actually called to indent the line is determined by the value of |
88 `indent-line-function'." | 88 `indent-line-function'." |
89 (interactive "P") | 89 (interactive "P") |
90 (cond | 90 (cond |
91 ;; The region is active, indent it. | |
92 ((and transient-mark-mode mark-active | |
93 (not (eq (region-beginning) (region-end)))) | |
94 (indent-region (region-beginning) (region-end))) | |
91 ((or ;; indent-to-left-margin is only meant for indenting, | 95 ((or ;; indent-to-left-margin is only meant for indenting, |
92 ;; so we force it to always insert a tab here. | 96 ;; so we force it to always insert a tab here. |
93 (eq indent-line-function 'indent-to-left-margin) | 97 (eq indent-line-function 'indent-to-left-margin) |
94 (and (not tab-always-indent) | 98 (and (not tab-always-indent) |
95 (or (> (current-column) (current-indentation)) | 99 (or (> (current-column) (current-indentation)) |
97 (insert-tab arg)) | 101 (insert-tab arg)) |
98 ;; Those functions are meant specifically for tabbing and not for | 102 ;; Those functions are meant specifically for tabbing and not for |
99 ;; indenting, so we can't pass them to indent-according-to-mode. | 103 ;; indenting, so we can't pass them to indent-according-to-mode. |
100 ((memq indent-line-function '(indent-relative indent-relative-maybe)) | 104 ((memq indent-line-function '(indent-relative indent-relative-maybe)) |
101 (funcall indent-line-function)) | 105 (funcall indent-line-function)) |
102 ;; The region is active, indent it. | |
103 ((and transient-mark-mode mark-active | |
104 (not (eq (region-beginning) (region-end)))) | |
105 (indent-region (region-beginning) (region-end))) | |
106 ;; Indent the line. | 106 ;; Indent the line. |
107 (t | 107 (t |
108 (indent-according-to-mode)))) | 108 (indent-according-to-mode)))) |
109 | 109 |
110 (defun insert-tab (&optional arg) | 110 (defun insert-tab (&optional arg) |