diff options
| author | Reuben Thomas | 2016-10-20 13:17:58 +0100 |
|---|---|---|
| committer | Reuben Thomas | 2016-11-03 12:16:56 +0000 |
| commit | 0a5ab4dd09b969540f6ebf4ee5954983ac10c36a (patch) | |
| tree | 627a05cbc1a556409b5b50f6ff0b9a8c3bfe576e | |
| parent | 76e297c15f6312a83599aab216be0396e9aac5c5 (diff) | |
| download | emacs-0a5ab4dd09b969540f6ebf4ee5954983ac10c36a.tar.gz emacs-0a5ab4dd09b969540f6ebf4ee5954983ac10c36a.zip | |
Fix bob/eob checks
* lisp/whitespace.el (whitespace-empty-at-bob-regexp)
(whitespace-empty-at-eob-regexp, whitespace-cleanup): Make `empty' checks
work at beginning & end of buffer in whitespace-report-region, and only
there (i.e. they will never match in regions that don't include the
start or end of the buffer). (Bug#24745)
| -rw-r--r-- | lisp/whitespace.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 0f6b8df03de..61645852f1f 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -828,7 +828,7 @@ Used when `whitespace-style' includes `indentation', | |||
| 828 | :group 'whitespace) | 828 | :group 'whitespace) |
| 829 | 829 | ||
| 830 | 830 | ||
| 831 | (defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)" | 831 | (defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)" |
| 832 | "Specify regexp for empty lines at beginning of buffer. | 832 | "Specify regexp for empty lines at beginning of buffer. |
| 833 | 833 | ||
| 834 | Used when `whitespace-style' includes `empty'." | 834 | Used when `whitespace-style' includes `empty'." |
| @@ -836,7 +836,7 @@ Used when `whitespace-style' includes `empty'." | |||
| 836 | :group 'whitespace) | 836 | :group 'whitespace) |
| 837 | 837 | ||
| 838 | 838 | ||
| 839 | (defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)" | 839 | (defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]*\\(\n\\{2,\\}\\|[ \t]+\\)\\)\\'" |
| 840 | "Specify regexp for empty lines at end of buffer. | 840 | "Specify regexp for empty lines at end of buffer. |
| 841 | 841 | ||
| 842 | Used when `whitespace-style' includes `empty'." | 842 | Used when `whitespace-style' includes `empty'." |
| @@ -1515,7 +1515,7 @@ documentation." | |||
| 1515 | (when (looking-at whitespace-empty-at-bob-regexp) | 1515 | (when (looking-at whitespace-empty-at-bob-regexp) |
| 1516 | (delete-region (match-beginning 1) (match-end 1))) | 1516 | (delete-region (match-beginning 1) (match-end 1))) |
| 1517 | (when (re-search-forward | 1517 | (when (re-search-forward |
| 1518 | (concat whitespace-empty-at-eob-regexp "\\'") nil t) | 1518 | whitespace-empty-at-eob-regexp nil t) |
| 1519 | (delete-region (match-beginning 1) (match-end 1))))))) | 1519 | (delete-region (match-beginning 1) (match-end 1))))))) |
| 1520 | ;; PROBLEM 3: 8 or more SPACEs at bol | 1520 | ;; PROBLEM 3: 8 or more SPACEs at bol |
| 1521 | ;; PROBLEM 4: SPACEs before TAB | 1521 | ;; PROBLEM 4: SPACEs before TAB |