Function: longlines-encode-region

longlines-encode-region is a byte-compiled function defined in longlines.el.gz.

Signature

(longlines-encode-region BEG END &optional BUFFER)

Documentation

Replace each soft newline between BEG and END with exactly one space.

Hard newlines are left intact. The optional argument BUFFER exists for compatibility with format-alist, and is ignored.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/longlines.el.gz
(defun longlines-encode-region (beg end &optional _buffer)
  "Replace each soft newline between BEG and END with exactly one space.
Hard newlines are left intact.  The optional argument BUFFER exists for
compatibility with `format-alist', and is ignored."
  (save-excursion
    (let ((reg-max (max beg end))
	  (mod (buffer-modified-p)))
      (goto-char (min beg end))
      (while (search-forward "\n" reg-max t)
	(let ((pos (match-beginning 0)))
	  (unless (get-text-property pos 'hard)
	    (goto-char (1+ pos))
	    (insert-and-inherit " ")
	    (delete-region pos (1+ pos))
            (remove-text-properties pos (1+ pos) '(hard nil)))))
      (set-buffer-modified-p mod)
      end)))