aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichal Nazarewicz2016-06-21 16:52:52 +0200
committerMichal Nazarewicz2016-07-04 23:44:06 +0200
commitdc294483af221066724f1007a595016b47fb5814 (patch)
treee81eb0d46998ec2d634de6d6df64c346ca63fb0b /test
parente3ae3c44882085bf52f6bb8b02e98eb7d0b1f81b (diff)
downloademacs-dc294483af221066724f1007a595016b47fb5814.tar.gz
emacs-dc294483af221066724f1007a595016b47fb5814.zip
Make ‘delete-trailing-whitespace’ delete spaces after form feed
* lisp/simple.el (delete-trailing-whitespace): Treat form fead as a non-whitespace character (regradless of whether it’s character syntax is whitespace) and delete any whitespace following it instead of leaving lines with form feeds completely unchanged. I.e. a line like "\f " will now became "\f".
Diffstat (limited to 'test')
-rw-r--r--test/lisp/simple-tests.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
index 40cd1d29498..2722544446d 100644
--- a/test/lisp/simple-tests.el
+++ b/test/lisp/simple-tests.el
@@ -204,7 +204,7 @@
204 204
205 205
206;;; `delete-trailing-whitespace' 206;;; `delete-trailing-whitespace'
207(ert-deftest simple-delete-trailing-whitespace () 207(ert-deftest simple-delete-trailing-whitespace--bug-21766 ()
208 "Test bug#21766: delete-whitespace sometimes deletes non-whitespace." 208 "Test bug#21766: delete-whitespace sometimes deletes non-whitespace."
209 (defvar python-indent-guess-indent-offset) ; to avoid a warning 209 (defvar python-indent-guess-indent-offset) ; to avoid a warning
210 (let ((python (featurep 'python)) 210 (let ((python (featurep 'python))
@@ -219,11 +219,24 @@
219 "\n" 219 "\n"
220 "\n")) 220 "\n"))
221 (delete-trailing-whitespace) 221 (delete-trailing-whitespace)
222 (should (equal (count-lines (point-min) (point-max)) 3))) 222 (should (string-equal (buffer-string)
223 (concat "query = \"\"\"WITH filtered AS\n"
224 "WHERE\n"
225 "\"\"\".format(fv_)\n"))))
223 ;; Let's clean up if running interactive 226 ;; Let's clean up if running interactive
224 (unless (or noninteractive python) 227 (unless (or noninteractive python)
225 (unload-feature 'python))))) 228 (unload-feature 'python)))))
226 229
230(ert-deftest simple-delete-trailing-whitespace--formfeeds ()
231 "Test formfeeds are not deleted but whitespace past them is."
232 (with-temp-buffer
233 (with-syntax-table (make-syntax-table)
234 (modify-syntax-entry ?\f " ") ; Make sure \f is whitespace
235 (insert " \f \n \f \f \n\nlast\n")
236 (delete-trailing-whitespace)
237 (should (string-equal (buffer-string) " \f\n \f \f\n\nlast\n"))
238 (should (equal ?\s (char-syntax ?\f))))))
239
227 240
228;;; auto-boundary tests 241;;; auto-boundary tests
229(ert-deftest undo-auto-boundary-timer () 242(ert-deftest undo-auto-boundary-timer ()