Function: current-fill-column

current-fill-column is a byte-compiled function defined in fill.el.gz.

Signature

(current-fill-column)

Documentation

Return the fill-column to use for this line.

The fill-column to use for a buffer is stored in the variable fill-column, but can be locally modified by the right-margin text property, which is subtracted from fill-column.

The fill column to use for a line is the first column at which the column number equals or exceeds the local fill-column - right-margin difference.

View in manual

Probably introduced at or before Emacs version 19.29.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/fill.el.gz
(defun current-fill-column ()
  "Return the fill-column to use for this line.
The fill-column to use for a buffer is stored in the variable `fill-column',
but can be locally modified by the `right-margin' text property, which is
subtracted from `fill-column'.

The fill column to use for a line is the first column at which the column
number equals or exceeds the local fill-column - right-margin difference."
  (save-excursion
    (if fill-column
	(let* ((here (line-beginning-position))
	       (here-col 0)
	       (eol (progn (end-of-line) (point)))
	       margin fill-col change col)
	  ;; Look separately at each region of line with a different
	  ;; right-margin.
	  (while (and (setq margin (get-text-property here 'right-margin)
			    fill-col (- fill-column (or margin 0))
			    change (text-property-not-all
				    here eol 'right-margin margin))
		      (progn (goto-char (1- change))
			     (setq col (current-column))
			     (< col fill-col)))
	    (setq here change
		  here-col col))
	  (max here-col fill-col))
      ;; This warning was added in 28.1.  It should be removed later,
      ;; and this function changed to never return nil.
      (unless current-fill-column--has-warned
        (lwarn '(fill-column) :warning
               "Setting this variable to nil is obsolete; use `(auto-fill-mode -1)' instead")
        (setq current-fill-column--has-warned t))
      most-positive-fixnum)))