Skip to content

Commit

Permalink
Remove evil-temp-filename
Browse files Browse the repository at this point in the history
With the previous change, this function just serves to obfuscate the use of
make-temp-file. It's probably clearer to use make-temp-file directly.
  • Loading branch information
justbur committed Jan 9, 2018
1 parent 5e1f851 commit 249d2e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions evil-test-helpers.el
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@ is executed at the end."
(goto-char (overlay-end ,overlay))
(evil-test-text (or ,end-string ,string) nil nil ,after-predicate))))

(defun evil-temp-filename ()
"Return an appropriate temporary filename."
(make-temp-file "evil-test"))

(defmacro evil-with-temp-file (file-var content &rest body)
"Create a temp file with CONTENT and bind its name to FILE-VAR within BODY.
FILE-VAR must be a symbol which contains the name of the
Expand All @@ -398,7 +394,7 @@ while the temporary file exists. The temporary file is deleted at
the end of the execution of BODY."
(declare (indent 2)
(debug (symbolp form body)))
`(let ((,file-var (evil-temp-filename)))
`(let ((,file-var (make-temp-file "evil-test")))
(with-temp-file ,file-var
,(if (stringp content)
`(insert ,content)
Expand Down
6 changes: 3 additions & 3 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -7445,23 +7445,23 @@ maybe we need one line more with some text\n")
(":w")
(file filename "line1\nline2\nline3\nline4\nline5\n"))))
(ert-info ("Write current buffer to new file")
(let ((filename (evil-temp-filename)))
(let ((filename (make-temp-file "evil-test-write")))
(evil-test-buffer
"[l]ine1\nline2\nline3\nline4\nline5\n"
(delete-file filename)
((vconcat ":w " filename [return]))
(file filename "line1\nline2\nline3\nline4\nline5\n")
(delete-file filename))))
(ert-info ("Write part of a buffer")
(let ((filename (evil-temp-filename)))
(let ((filename (make-temp-file "evil-test-write")))
(evil-test-buffer
"[l]ine1\nline2\nline3\nline4\nline5\n"
(delete-file filename)
((vconcat ":2,3w " filename [return]))
(file filename "line2\nline3\n")
(delete-file filename))))
(ert-info ("Appending a file")
(let ((filename (evil-temp-filename)))
(let ((filename (make-temp-file "evil-test-write")))
(evil-test-buffer
"[l]ine1\nline2\nline3\nline4\nline5\n"
(delete-file filename)
Expand Down

0 comments on commit 249d2e8

Please sign in to comment.