unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: tastytea <tastytea@tastytea.de>
Cc: 36837@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	[thread overview]
Message-ID: <87imrebo1c.fsf@gmail.com> (raw)
In-Reply-To: <20190803095056.75166d14@ventiloplattform.tastytea.de>

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

On Sat, 03 Aug 2019 09:50:56 +0200
tastytea@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: whitespace.diff --]
[-- Type: text/x-patch, Size: 1686 bytes --]

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 \

  reply	other threads:[~2019-08-03  9:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29  9:17 bug#36837: 26.2; whitespace-mode: whitespace-line-column is not set to local fill-column tastytea
2019-08-02 14:57 ` Štěpán Němec
2019-08-02 15:04   ` Andreas Schwab
2019-08-02 15:11     ` Štěpán Němec
2019-08-02 15:15       ` Andreas Schwab
2019-08-02 15:22         ` Štěpán Němec
2019-08-02 15:33           ` Andreas Schwab
2019-08-02 15:20       ` Eli Zaretskii
2019-08-02 15:30         ` Štěpán Němec
2019-08-02 18:51           ` Eli Zaretskii
2019-08-02 19:10             ` Štěpán Němec
2019-08-02 19:39               ` Eli Zaretskii
2019-08-02 19:28       ` Noam Postavsky
2019-08-02 19:45         ` Štěpán Němec
2019-08-02 21:14           ` Noam Postavsky
2019-08-02 21:50             ` Štěpán Němec
2019-08-02 21:54               ` Andreas Schwab
2019-08-03  7:50   ` tastytea
2019-08-03  9:23     ` Štěpán Němec [this message]
2020-02-24 19:56       ` Noam Postavsky
2020-02-24 20:12         ` Štěpán Němec
2020-02-26  0:38           ` Noam Postavsky
2020-02-28  5:01             ` Eli Zaretskii
2020-02-28  8:14               ` Štěpán Němec
2020-03-02  3:58                 ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imrebo1c.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=36837@debbugs.gnu.org \
    --cc=tastytea@tastytea.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).