Mercurial > emacs
comparison lisp/indent.el @ 91040:14c4a6aac623
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 866-879)
- Merge multi-tty branch
- Update from CVS
- Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 11 Oct 2007 16:14:00 +0000 |
parents | f55f9811f5d7 f4b3c97a692f |
children | 1251cabc40b7 |
comparison
equal
deleted
inserted
replaced
91039:eefadc1e1d5e | 91040:14c4a6aac623 |
---|---|
76 (save-excursion (indent-line-to column)))) | 76 (save-excursion (indent-line-to column)))) |
77 ;; The normal case. | 77 ;; The normal case. |
78 (funcall indent-line-function))) | 78 (funcall indent-line-function))) |
79 | 79 |
80 (defun indent-for-tab-command (&optional arg) | 80 (defun indent-for-tab-command (&optional arg) |
81 "Indent line in proper way for current major mode or insert a tab. | 81 "Indent line or region in proper way for current major mode or insert a tab. |
82 Depending on `tab-always-indent', either insert a tab or indent. | 82 Depending on `tab-always-indent', either insert a tab or indent. |
83 If initial point was within line's indentation, position after | 83 If initial point was within line's indentation, position after |
84 the indentation. Else stay at same point in text. | 84 the indentation. Else stay at same point in text. |
85 The function actually called to indent is determined by the value of | 85 If `transient-mark-mode' is turned on the region is active, |
86 indent the region. | |
87 The function actually called to indent the line is determined by the value of | |
86 `indent-line-function'." | 88 `indent-line-function'." |
87 (interactive "P") | 89 (interactive "P") |
88 (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))) | |
89 ((or ;; indent-to-left-margin is only meant for indenting, | 95 ((or ;; indent-to-left-margin is only meant for indenting, |
90 ;; so we force it to always insert a tab here. | 96 ;; so we force it to always insert a tab here. |
91 (eq indent-line-function 'indent-to-left-margin) | 97 (eq indent-line-function 'indent-to-left-margin) |
92 (and (not tab-always-indent) | 98 (and (not tab-always-indent) |
93 (or (> (current-column) (current-indentation)) | 99 (or (> (current-column) (current-indentation)) |
95 (insert-tab arg)) | 101 (insert-tab arg)) |
96 ;; Those functions are meant specifically for tabbing and not for | 102 ;; Those functions are meant specifically for tabbing and not for |
97 ;; 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. |
98 ((memq indent-line-function '(indent-relative indent-relative-maybe)) | 104 ((memq indent-line-function '(indent-relative indent-relative-maybe)) |
99 (funcall indent-line-function)) | 105 (funcall indent-line-function)) |
100 (t ;; The normal case. | 106 ;; Indent the line. |
107 (t | |
101 (indent-according-to-mode)))) | 108 (indent-according-to-mode)))) |
102 | 109 |
103 (defun insert-tab (&optional arg) | 110 (defun insert-tab (&optional arg) |
104 (let ((count (prefix-numeric-value arg))) | 111 (let ((count (prefix-numeric-value arg))) |
105 (if (and abbrev-mode | 112 (if (and abbrev-mode |