emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 02a2fba: Use `special-mode' for whitespace-report


From: Lars Ingebrigtsen
Subject: master 02a2fba: Use `special-mode' for whitespace-report
Date: Tue, 21 Sep 2021 01:23:47 -0400 (EDT)

branch: master
commit 02a2fba7869db7ae23c65ab1ea47db7ba556ffac
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Use `special-mode' for whitespace-report
    
    * lisp/whitespace.el (whitespace-report-region): Use
    `special-mode' instead of `fundamental-mode' (bug#50715).
---
 lisp/whitespace.el | 48 +++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 7e09017..08f809a 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1722,30 +1722,32 @@ cleaning up these problems."
               (ws-tab-width tab-width))
           (with-current-buffer (get-buffer-create
                                 whitespace-report-buffer-name)
-            (erase-buffer)
-            (insert (if ws-indent-tabs-mode
-                        (car whitespace-report-text)
-                      (cdr whitespace-report-text)))
-            (goto-char (point-min))
-            (forward-line 3)
-            (dolist (option whitespace-report-list)
+            (let ((inhibit-read-only t))
+              (special-mode)
+              (erase-buffer)
+              (insert (if ws-indent-tabs-mode
+                          (car whitespace-report-text)
+                        (cdr whitespace-report-text)))
+              (goto-char (point-min))
+              (forward-line 3)
+              (dolist (option whitespace-report-list)
+                (forward-line 1)
+                (whitespace-mark-x
+                 27 (memq (car option) style))
+                (whitespace-mark-x 7 (car bogus-list))
+                (setq bogus-list (cdr bogus-list)))
               (forward-line 1)
-              (whitespace-mark-x
-               27 (memq (car option) style))
-              (whitespace-mark-x 7 (car bogus-list))
-              (setq bogus-list (cdr bogus-list)))
-            (forward-line 1)
-            (whitespace-insert-value ws-indent-tabs-mode)
-            (whitespace-insert-value ws-tab-width)
-            (when has-bogus
-              (goto-char (point-max))
-              (insert (substitute-command-keys
-                       " Type `\\[whitespace-cleanup]'")
-                      " to cleanup the buffer.\n\n"
-                      (substitute-command-keys
-                       " Type `\\[whitespace-cleanup-region]'")
-                      " to cleanup a region.\n\n"))
-            (whitespace-display-window (current-buffer)))))
+              (whitespace-insert-value ws-indent-tabs-mode)
+              (whitespace-insert-value ws-tab-width)
+              (when has-bogus
+                (goto-char (point-max))
+                (insert (substitute-command-keys
+                         " Type `\\[whitespace-cleanup]'")
+                        " to cleanup the buffer.\n\n"
+                        (substitute-command-keys
+                         " Type `\\[whitespace-cleanup-region]'")
+                        " to cleanup a region.\n\n"))
+              (whitespace-display-window (current-buffer))))))
       has-bogus)))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]