[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0a5ab4d 1/6: Fix bob/eob checks
From: |
Reuben Thomas |
Subject: |
[Emacs-diffs] master 0a5ab4d 1/6: Fix bob/eob checks |
Date: |
Thu, 3 Nov 2016 12:17:07 +0000 (UTC) |
branch: master
commit 0a5ab4dd09b969540f6ebf4ee5954983ac10c36a
Author: Reuben Thomas <address@hidden>
Commit: Reuben Thomas <address@hidden>
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)
---
lisp/whitespace.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0f6b8df..6164585 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -828,7 +828,7 @@ Used when `whitespace-style' includes `indentation',
:group 'whitespace)
-(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)"
+(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
"Specify regexp for empty lines at beginning of buffer.
Used when `whitespace-style' includes `empty'."
@@ -836,7 +836,7 @@ Used when `whitespace-style' includes `empty'."
:group 'whitespace)
-(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)"
+(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]*\\(\n\\{2,\\}\\|[
\t]+\\)\\)\\'"
"Specify regexp for empty lines at end of buffer.
Used when `whitespace-style' includes `empty'."
@@ -1515,7 +1515,7 @@ documentation."
(when (looking-at whitespace-empty-at-bob-regexp)
(delete-region (match-beginning 1) (match-end 1)))
(when (re-search-forward
- (concat whitespace-empty-at-eob-regexp "\\'") nil t)
+ whitespace-empty-at-eob-regexp nil t)
(delete-region (match-beginning 1) (match-end 1)))))))
;; PROBLEM 3: 8 or more SPACEs at bol
;; PROBLEM 4: SPACEs before TAB
- [Emacs-diffs] master updated (76e297c -> 86bec41), Reuben Thomas, 2016/11/03
- [Emacs-diffs] master 0a5ab4d 1/6: Fix bob/eob checks,
Reuben Thomas <=
- [Emacs-diffs] master 2350bb9 4/6: Make whitespace-report-region respect current settings, Reuben Thomas, 2016/11/03
- [Emacs-diffs] master 86bec41 6/6: Stop force parameter of whitespace-report-region having global effect, Reuben Thomas, 2016/11/03
- [Emacs-diffs] master 50bba7f 5/6: Document use of `tab-width', Reuben Thomas, 2016/11/03
- [Emacs-diffs] master a55c582 3/6: Fix whitespace-space-after-tab-regexp, Reuben Thomas, 2016/11/03
- [Emacs-diffs] master 96f3ae9 2/6: Remove duplicate documentation, Reuben Thomas, 2016/11/03