Function: set-right-margin

set-right-margin is an interactive and byte-compiled function defined in indent.el.gz.

Signature

(set-right-margin FROM TO WIDTH)

Documentation

Set the right margin of the region to WIDTH.

If auto-fill-mode is active, re-fill the region to fit the new margin.

Interactively, WIDTH is the prefix argument, if specified. Without prefix argument, the command prompts for WIDTH.

View in manual

Probably introduced at or before Emacs version 19.29.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/indent.el.gz
(defun set-right-margin (from to width)
  "Set the right margin of the region to WIDTH.
If `auto-fill-mode' is active, re-fill the region to fit the new margin.

Interactively, WIDTH is the prefix argument, if specified.
Without prefix argument, the command prompts for WIDTH."
  (interactive "r\nNSet right margin to width: ")
  (save-excursion
    (goto-char from)
    (skip-chars-backward " \t")
    (if (bolp) (setq from (point))))
  (put-text-property from to 'right-margin width)
  (if auto-fill-function (save-excursion (fill-region from to nil t t))))