Emacs Lisp: file-to-list function reads file line by line into a list

Emacs Lisp: file-to-list function reads file line by line into a list

This Emacs Lisp function reads file line by line and returns list of lines. This may be handy when lines of the file need to be processed.

There may be better versions of this function, this is simple enough and satisfies my needs.

(defun file-to-list (file)
  "Return a list of lines of a file"
  (with-temp-buffer
    (insert-file-contents file)
    (split-string (buffer-string) "\n" t)))

You are welcome to tell me any better version!

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: