Function: elisp-refs--lines

elisp-refs--lines is a byte-compiled function defined in elisp-refs.el.

Signature

(elisp-refs--lines STRING)

Documentation

Return a list of all the lines in STRING.

'a
b' -> ('a
' 'b')

Source Code

;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--lines (string)
  "Return a list of all the lines in STRING.
'a\nb' -> ('a\n' 'b')"
  (let ((lines nil))
    (while (> (length string) 0)
      (let ((index (s-index-of "\n" string)))
        (if index
            (progn
              (push (substring string 0 (1+ index)) lines)
              (setq string (substring string (1+ index))))
          (push string lines)
          (setq string ""))))
    (nreverse lines)))