Elisp: Read File Content as String or Lines
Read File Content into a String
(defun get-string-from-file (filePath) "Return file content as string." (with-temp-buffer (insert-file-contents filePath) (buffer-string))) ;; 2010-09-02 thanks to Pascal J Bourguignon and TheFlyingDutchman [zzbba…@aol.com]
Read File Content as List of Lines
(defun read-lines (filePath) "Return a list of lines of a file at filePath." (with-temp-buffer (insert-file-contents filePath) (split-string (buffer-string) "\n" t)))
Elisp, File, Buffer
- Elisp: Buffer Functions
- Elisp: Read File
- Elisp: Read File Content as String or Lines
- Elisp: Write File
- Elisp: Open File, Read, Possibly Write
- Elisp: File and Directory Functions
- Elisp: Get File Info
- Elisp: File Path Functions
- Elisp: Walk Directory, List Files
- Elisp: Walk Directory by Depth 🚀
- Elisp: Get Dired Marked Files