Omit last empty element in shell-lines.

New file-lines function.
This commit is contained in:
Marius Vollmer 2008-08-06 04:13:40 +03:00
parent 7ce74c2879
commit c4afadff2e

View file

@ -49,7 +49,15 @@
(let ((str (shell-command-to-string (apply 'format cmd args))))
(if (string= str "")
nil
(split-string str "\n"))))
(let ((lines (nreverse (split-string str "\n"))))
(if (string= (car lines) "")
(setq lines (cdr lines)))
(nreverse lines)))))
(defun magit-file-lines (file)
(if (file-exists-p file)
(magit-shell-lines "cat '%s'" file)
nil))
(defun magit-concat-with-delim (delim seqs)
(cond ((null seqs)