1 |
;;; indent.el --- indentation commands for Emacs |
;;; indent.el --- indentation commands for Emacs |
2 |
|
|
3 |
;; Copyright (C) 1985, 1995, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1985, 1995, 2001, 2004 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Maintainer: FSF |
;; Maintainer: FSF |
6 |
|
|
198 |
(forward-line 1)) |
(forward-line 1)) |
199 |
(move-marker to nil))) |
(move-marker to nil))) |
200 |
|
|
201 |
(defun set-left-margin (from to lm) |
(defun set-left-margin (from to width) |
202 |
"Set the left margin of the region to WIDTH. |
"Set the left margin of the region to WIDTH. |
203 |
If `auto-fill-mode' is active, re-fill the region to fit the new margin." |
If `auto-fill-mode' is active, re-fill the region to fit the new margin. |
204 |
|
|
205 |
|
Interactively, WIDTH is the prefix argument, if specified. |
206 |
|
Without prefix argument, the command prompts for WIDTH." |
207 |
(interactive "r\nNSet left margin to column: ") |
(interactive "r\nNSet left margin to column: ") |
208 |
(if (interactive-p) (setq lm (prefix-numeric-value lm))) |
(if (interactive-p) (setq width (prefix-numeric-value width))) |
209 |
(save-excursion |
(save-excursion |
210 |
;; If inside indentation, start from BOL. |
;; If inside indentation, start from BOL. |
211 |
(goto-char from) |
(goto-char from) |
217 |
(setq to (point-marker))) |
(setq to (point-marker))) |
218 |
;; Delete margin indentation first, but keep paragraph indentation. |
;; Delete margin indentation first, but keep paragraph indentation. |
219 |
(delete-to-left-margin from to) |
(delete-to-left-margin from to) |
220 |
(put-text-property from to 'left-margin lm) |
(put-text-property from to 'left-margin width) |
221 |
(indent-rigidly from to lm) |
(indent-rigidly from to width) |
222 |
(if auto-fill-function (save-excursion (fill-region from to nil t t))) |
(if auto-fill-function (save-excursion (fill-region from to nil t t))) |
223 |
(move-marker to nil)) |
(move-marker to nil)) |
224 |
|
|
225 |
(defun set-right-margin (from to lm) |
(defun set-right-margin (from to width) |
226 |
"Set the right margin of the region to WIDTH. |
"Set the right margin of the region to WIDTH. |
227 |
If `auto-fill-mode' is active, re-fill the region to fit the new margin." |
If `auto-fill-mode' is active, re-fill the region to fit the new margin. |
228 |
|
|
229 |
|
Interactively, WIDTH is the prefix argument, if specified. |
230 |
|
Without prefix argument, the command prompts for WIDTH." |
231 |
(interactive "r\nNSet right margin to width: ") |
(interactive "r\nNSet right margin to width: ") |
232 |
(if (interactive-p) (setq lm (prefix-numeric-value lm))) |
(if (interactive-p) (setq width (prefix-numeric-value width))) |
233 |
(save-excursion |
(save-excursion |
234 |
(goto-char from) |
(goto-char from) |
235 |
(skip-chars-backward " \t") |
(skip-chars-backward " \t") |
236 |
(if (bolp) (setq from (point)))) |
(if (bolp) (setq from (point)))) |
237 |
(put-text-property from to 'right-margin lm) |
(put-text-property from to 'right-margin width) |
238 |
(if auto-fill-function (save-excursion (fill-region from to nil t t)))) |
(if auto-fill-function (save-excursion (fill-region from to nil t t)))) |
239 |
|
|
240 |
(defun alter-text-property (from to prop func &optional object) |
(defun alter-text-property (from to prop func &optional object) |