Skip to content

Commit

Permalink
no-nl-eof allows empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
glasserc committed Apr 26, 2010
1 parent c721332 commit 075b2f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lisp/ethan-wspace.el
Expand Up @@ -362,7 +362,8 @@ This internally uses `show-trailing-whitespace'."
(defun ethan-wspace-type-no-nl-eof-find () (defun ethan-wspace-type-no-nl-eof-find ()
(let* ((trailing-newlines (ethan-wspace-count-trailing-nls)) (let* ((trailing-newlines (ethan-wspace-count-trailing-nls))
(max (point-max))) (max (point-max)))
(if (= trailing-newlines 0) (if (and (= trailing-newlines 0)
(not (= (buffer-size) 0))) ; don't count empty files as dirty
(cons max max) (cons max max)
nil))) nil)))


Expand All @@ -372,7 +373,8 @@ This internally uses `show-trailing-whitespace'."
(save-excursion (save-excursion
(goto-char (point-max)) (goto-char (point-max))
(skip-chars-backward "\n") (skip-chars-backward "\n")
(if (not (looking-at "\n")) (if (and (not (looking-at "\n"))
(not (= (buffer-size) 0))) ; don't need to clean empty files
(insert "\n"))))) (insert "\n")))))




Expand Down
Empty file added tests/empty.txt
Empty file.

0 comments on commit 075b2f5

Please sign in to comment.