diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2016-06-21 16:46:52 +0200 |
---|---|---|
committer | Michal Nazarewicz <mina86@mina86.com> | 2016-07-04 23:44:06 +0200 |
commit | 7c6317a0498b6690ea668909ac012cb45e6f809b (patch) | |
tree | addc7968bfe0759b83b35dc95acb2d35d835f576 /test/lisp/help-fns-tests.el | |
parent | dc294483af221066724f1007a595016b47fb5814 (diff) | |
download | emacs-7c6317a0498b6690ea668909ac012cb45e6f809b.tar.gz emacs-7c6317a0498b6690ea668909ac012cb45e6f809b.tar.bz2 emacs-7c6317a0498b6690ea668909ac012cb45e6f809b.zip |
Simplify ‘delete-trailing-whitespace’ by not treating \n as whitespace
* lisp/simple.el (delete-trailing-whitespace): Set newline’s character
syntax to non-whitespace so that ‘\s-’ regular expression does not match
it.
This simplifies the loop slightly since a simple ‘\s-+$’ can be used and
as a consequence ‘line-beginning-position’ function does not need to be
called any longer.
Furthermore, when newline has whitespace syntax, ‘\s-$’ regular
expression ends up matching empty lins since ‘\s-’ matches newline
characetr of proceeding line. This leads to needless loop iterations.
Since previous change to ‘delete-trailing-whitespace’ already introduced
‘with-syntax-table’, take advantage of it and also overwrite newline’s
character syntax.
Diffstat (limited to 'test/lisp/help-fns-tests.el')
0 files changed, 0 insertions, 0 deletions