]> code.delx.au - gnu-emacs-elpa/blob - packages/yasnippet/snippets/emacs-lisp-mode/x-file.read-lines.yasnippet
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / yasnippet / snippets / emacs-lisp-mode / x-file.read-lines.yasnippet
1 # contributor: Xah Lee (XahLee.org)
2 # name: read lines of a file
3 # key: x-file
4 # --
5 (defun read-lines (filePath)
6 "Return a list of lines in FILEPATH."
7 (with-temp-buffer
8 (insert-file-contents filePath)
9 (split-string
10 (buffer-string) "\n" t)) )
11
12 ;; process all lines
13 (mapc
14 (lambda (aLine)
15 (message aLine) ; do your stuff here
16 )
17 (read-lines "inputFilePath")
18 )