Mercurial > hg > xemacs-beta
comparison lisp/indent.el @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | 3ecd8885ac67 |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
62 (if indent-tabs-mode | 62 (if indent-tabs-mode |
63 (insert-char ?\t count) | 63 (insert-char ?\t count) |
64 ;; XEmacs: (Need the `1+') | 64 ;; XEmacs: (Need the `1+') |
65 (indent-to (* tab-width (1+ (/ (current-column) tab-width))))))) | 65 (indent-to (* tab-width (1+ (/ (current-column) tab-width))))))) |
66 | 66 |
67 (defun indent-rigidly (start end arg) | 67 (defun indent-rigidly (start end count) |
68 "Indent all lines starting in the region sideways by ARG columns. | 68 "Indent all lines starting in the region sideways by COUNT columns. |
69 Called from a program, takes three arguments, START, END and ARG." | 69 Called from a program, takes three arguments, START, END and COUNT." |
70 (interactive "r\np") | 70 (interactive "r\np") |
71 (save-excursion | 71 (save-excursion |
72 (goto-char end) | 72 (goto-char end) |
73 (setq end (point-marker)) | 73 (setq end (point-marker)) |
74 (goto-char start) | 74 (goto-char start) |
78 eol-flag) | 78 eol-flag) |
79 (save-excursion | 79 (save-excursion |
80 (skip-chars-forward " \t") | 80 (skip-chars-forward " \t") |
81 (setq eol-flag (eolp))) | 81 (setq eol-flag (eolp))) |
82 (or eol-flag | 82 (or eol-flag |
83 (indent-to (max 0 (+ indent arg)) 0)) | 83 (indent-to (max 0 (+ indent count)) 0)) |
84 (delete-region (point) (progn (skip-chars-forward " \t") (point)))) | 84 (delete-region (point) (progn (skip-chars-forward " \t") (point)))) |
85 (forward-line 1)) | 85 (forward-line 1)) |
86 (move-marker end nil) | 86 (move-marker end nil) |
87 (setq zmacs-region-stays nil))) ; XEmacs | 87 (setq zmacs-region-stays nil))) ; XEmacs |
88 | 88 |
137 "Indent current line to the column given by `current-left-margin'." | 137 "Indent current line to the column given by `current-left-margin'." |
138 (indent-line-to (current-left-margin))) | 138 (indent-line-to (current-left-margin))) |
139 | 139 |
140 (defun delete-to-left-margin (&optional from to) | 140 (defun delete-to-left-margin (&optional from to) |
141 "Remove left margin indentation from a region. | 141 "Remove left margin indentation from a region. |
142 This deletes to the column given by `current-left-margin'. | 142 The amount of indentation to delete is determined by calling the |
143 function `current-left-margin'. | |
143 In no case will it delete non-whitespace. | 144 In no case will it delete non-whitespace. |
144 Args FROM and TO are optional; default is the whole buffer." | 145 Args FROM and TO are optional; default is the whole buffer." |
145 (save-excursion | 146 (save-excursion |
146 (goto-char (or to (point-max))) | 147 (goto-char (or to (point-max))) |
147 (setq to (point-marker)) | 148 (setq to (point-marker)) |
262 (defun beginning-of-line-text (&optional n) | 263 (defun beginning-of-line-text (&optional n) |
263 "Move to the beginning of the text on this line. | 264 "Move to the beginning of the text on this line. |
264 With optional argument, move forward N-1 lines first. | 265 With optional argument, move forward N-1 lines first. |
265 From the beginning of the line, moves past the left-margin indentation, the | 266 From the beginning of the line, moves past the left-margin indentation, the |
266 fill-prefix, and any indentation used for centering or right-justifying the | 267 fill-prefix, and any indentation used for centering or right-justifying the |
267 line, but does not move past any whitespace that was explicitly inserted | 268 line, but does not move past any whitespace that was explicitly inserted |
268 \(such as a tab used to indent the first line of a paragraph)." | 269 \(such as a tab used to indent the first line of a paragraph)." |
269 (interactive "p") | 270 (interactive "p") |
270 (beginning-of-line n) | 271 (beginning-of-line n) |
271 (skip-chars-forward " \t") | 272 (skip-chars-forward " \t") |
272 ;; Skip over fill-prefix. | 273 ;; Skip over fill-prefix. |
273 (if (and fill-prefix | 274 (if (and fill-prefix |
274 (not (string-equal fill-prefix ""))) | 275 (not (string-equal fill-prefix ""))) |
275 (if (equal fill-prefix | 276 (if (equal fill-prefix |
276 (buffer-substring | 277 (buffer-substring |
277 (point) (min (point-max) (+ (length fill-prefix) (point))))) | 278 (point) (min (point-max) (+ (length fill-prefix) (point))))) |
278 (forward-char (length fill-prefix))) | 279 (forward-char (length fill-prefix))) |
279 (if (and adaptive-fill-mode adaptive-fill-regexp | 280 (if (and adaptive-fill-mode adaptive-fill-regexp |
280 (looking-at adaptive-fill-regexp)) | 281 (looking-at adaptive-fill-regexp)) |
281 (goto-char (match-end 0)))) | 282 (goto-char (match-end 0)))) |