comparison lisp/indent.el @ 57297:42311c6c4bdb

(set-left-margin, set-right-margin): Rename `lm' arg to `width' for consistency with docstring. Doc fix.
author Luc Teirlinck <teirllm@auburn.edu>
date Sat, 02 Oct 2004 00:16:19 +0000
parents 11b507f888a6
children 94dfa49e7a83 58db929d96c6
comparison
equal deleted inserted replaced
57296:4a3c03577205 57297:42311c6c4bdb
1 ;;; indent.el --- indentation commands for Emacs 1 ;;; indent.el --- indentation commands for Emacs
2 2
3 ;; Copyright (C) 1985, 1995, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 1995, 2001, 2004 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
196 (while (< (point) to) 196 (while (< (point) to)
197 (delete-region (point) (progn (move-to-left-margin nil t) (point))) 197 (delete-region (point) (progn (move-to-left-margin nil t) (point)))
198 (forward-line 1)) 198 (forward-line 1))
199 (move-marker to nil))) 199 (move-marker to nil)))
200 200
201 (defun set-left-margin (from to lm) 201 (defun set-left-margin (from to width)
202 "Set the left margin of the region to WIDTH. 202 "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." 203 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."
204 (interactive "r\nNSet left margin to column: ") 207 (interactive "r\nNSet left margin to column: ")
205 (if (interactive-p) (setq lm (prefix-numeric-value lm))) 208 (if (interactive-p) (setq width (prefix-numeric-value width)))
206 (save-excursion 209 (save-excursion
207 ;; If inside indentation, start from BOL. 210 ;; If inside indentation, start from BOL.
208 (goto-char from) 211 (goto-char from)
209 (skip-chars-backward " \t") 212 (skip-chars-backward " \t")
210 (if (bolp) (setq from (point))) 213 (if (bolp) (setq from (point)))
212 (goto-char to) 215 (goto-char to)
213 (skip-chars-forward " \t") 216 (skip-chars-forward " \t")
214 (setq to (point-marker))) 217 (setq to (point-marker)))
215 ;; Delete margin indentation first, but keep paragraph indentation. 218 ;; Delete margin indentation first, but keep paragraph indentation.
216 (delete-to-left-margin from to) 219 (delete-to-left-margin from to)
217 (put-text-property from to 'left-margin lm) 220 (put-text-property from to 'left-margin width)
218 (indent-rigidly from to lm) 221 (indent-rigidly from to width)
219 (if auto-fill-function (save-excursion (fill-region from to nil t t))) 222 (if auto-fill-function (save-excursion (fill-region from to nil t t)))
220 (move-marker to nil)) 223 (move-marker to nil))
221 224
222 (defun set-right-margin (from to lm) 225 (defun set-right-margin (from to width)
223 "Set the right margin of the region to WIDTH. 226 "Set the right margin of the region to WIDTH.
224 If `auto-fill-mode' is active, re-fill the region to fit the new margin." 227 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."
225 (interactive "r\nNSet right margin to width: ") 231 (interactive "r\nNSet right margin to width: ")
226 (if (interactive-p) (setq lm (prefix-numeric-value lm))) 232 (if (interactive-p) (setq width (prefix-numeric-value width)))
227 (save-excursion 233 (save-excursion
228 (goto-char from) 234 (goto-char from)
229 (skip-chars-backward " \t") 235 (skip-chars-backward " \t")
230 (if (bolp) (setq from (point)))) 236 (if (bolp) (setq from (point))))
231 (put-text-property from to 'right-margin lm) 237 (put-text-property from to 'right-margin width)
232 (if auto-fill-function (save-excursion (fill-region from to nil t t)))) 238 (if auto-fill-function (save-excursion (fill-region from to nil t t))))
233 239
234 (defun alter-text-property (from to prop func &optional object) 240 (defun alter-text-property (from to prop func &optional object)
235 "Programmatically change value of a text-property. 241 "Programmatically change value of a text-property.
236 For each region between FROM and TO that has a single value for PROPERTY, 242 For each region between FROM and TO that has a single value for PROPERTY,