Function: longlines-encode-string

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

Signature

(longlines-encode-string STRING)

Documentation

Return a copy of STRING with each soft newline removed.

Hard newlines are left intact.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/longlines.el.gz
(defun longlines-encode-string (string)
  "Return a copy of STRING with each soft newline removed.
Hard newlines are left intact."
  (let ((start 0)
        (result nil)
        pos)
    (while (setq pos (string-search "\n" string start))
      (unless (= start pos)
        (push (substring string start pos) result))
      (when (get-text-property pos 'hard string)
        (push (substring string pos (1+ pos)) result))
      (setq start (1+ pos)))
    (if (null result)
        (copy-sequence string)
      (unless (= start (length string))
        (push (substring string start) result))
      (apply #'concat (nreverse result)))))