GNU bug report logs - #36837
26.2; whitespace-mode: whitespace-line-column is not set to local fill-column

Previous Next

Package: emacs;

Reported by: tastytea <tastytea <at> tastytea.de>

Date: Mon, 29 Jul 2019 14:40:02 UTC

Severity: minor

Found in version 26.2

Fixed in version 28.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Štěpán Němec <stepnem <at> gmail.com>
To: tastytea <tastytea <at> tastytea.de>
Cc: 36837 <at> debbugs.gnu.org
Subject: bug#36837: 26.2; whitespace-mode: whitespace-line-column is not set to local fill-column
Date: Sat, 03 Aug 2019 11:23:27 +0200
[Message part 1 (text/plain, inline)]
On Sat, 03 Aug 2019 09:50:56 +0200
tastytea <at> tastytea.de wrote:

> Maybe whitespace-mode could watch fill-column for changes, at least
> until the file-local variables are loaded?
> There is also the possibility that fill-column is changed afterwards by
> the user, but I guess that's not too common…

Ah, the new variable watcher thing. I suppose that would be a
possibility, though so far its use in Emacs seems to be quite limited.

Less avant-garde perhaps would be to do what's being done for some of
the other regexps already: turn it into a function:

[whitespace.diff (text/x-patch, inline)]
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index d0368b54a8..a67e5efee5 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -2066,16 +2066,7 @@ whitespace-color-on
        ,@(when (or (memq 'lines      whitespace-active-style)
                    (memq 'lines-tail whitespace-active-style))
            ;; Show "long" lines.
-           `((,(let ((line-column (or whitespace-line-column fill-column)))
-                 (format
-                  "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
-                  tab-width
-                  (1- tab-width)
-                  (/ line-column tab-width)
-                  (let ((rem (% line-column tab-width)))
-                    (if (zerop rem)
-                        ""
-                      (format ".\\{%d\\}" rem)))))
+           `((,#'whitespace-lines-regexp
               ,(if (memq 'lines whitespace-active-style)
                    0                    ; whole line
                  2)                     ; line tail
@@ -2176,6 +2167,19 @@ whitespace-trailing-regexp
 	     (setq status nil)))		  ;; end of buffer
     status))
 
+(defun whitespace-lines-regexp (limit)
+  (re-search-forward
+   (let ((line-column (or whitespace-line-column fill-column)))
+     (format
+      "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
+      tab-width
+      (1- tab-width)
+      (/ line-column tab-width)
+      (let ((rem (% line-column tab-width)))
+        (if (zerop rem)
+            ""
+          (format ".\\{%d\\}" rem)))))
+   limit t))
 
 (defun whitespace-empty-at-bob-regexp (limit)
   "Match spaces at beginning of buffer which do not contain the point at \

This bug report was last modified 5 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.