From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs 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-ID: <87imrebo1c.fsf@gmail.com> References: <20190729111756.0665feb6@ventiloplattform.tastytea.de> <87k1bvfwda.fsf@gmail.com> <20190803095056.75166d14@ventiloplattform.tastytea.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="213365"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 36837@debbugs.gnu.org To: tastytea Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 11:24:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htqGn-000tPQ-K3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 11:24:09 +0200 Original-Received: from localhost ([::1]:39054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htqGl-0003fU-VS for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 05:24:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51425) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htqGh-0003eA-9c for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 05:24:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htqGg-0003OD-5g for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 05:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49471) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1htqGf-0003Mk-Uo for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 05:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1htqGf-00028M-Lc for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 05:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 09:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36837 X-GNU-PR-Package: emacs Original-Received: via spool by 36837-submit@debbugs.gnu.org id=B36837.15648242188171 (code B ref 36837); Sat, 03 Aug 2019 09:24:01 +0000 Original-Received: (at 36837) by debbugs.gnu.org; 3 Aug 2019 09:23:38 +0000 Original-Received: from localhost ([127.0.0.1]:58292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htqGH-00027j-Je for submit@debbugs.gnu.org; Sat, 03 Aug 2019 05:23:37 -0400 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:39247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htqGF-00027W-Kl for 36837@debbugs.gnu.org; Sat, 03 Aug 2019 05:23:36 -0400 Original-Received: by mail-wr1-f41.google.com with SMTP id x4so26400290wrt.6 for <36837@debbugs.gnu.org>; Sat, 03 Aug 2019 02:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=QwYlChfbrpLu0LW5e2tcCE5UCRdfxp+7b94EY+A7IjQ=; b=Mb0I9OjiKwG5xt9quwgehHMzkalCaQdQ1AisjB92mHNglGb2LmZOVpXgTex3KSqoJw 98MuKUTFDTH9T8IXq66LYYRnm6bMnP2Cbckb8tfveWGnEdjZPdSIvKZM7mNxIT9yPULB ikbJyFMWRqHogvHkvmkgp7YjqG5Ppdr3g9GyhfKKk1dku8cOFTIFo2uueff9xMGEkr0x meBQpdSyiU3zAZ85RYu8VpHdOawk3XbklFj6GKT8A+Vk2WZT20YnWcCLCSH7/yYkq2FW F9MZ6dMl40vyOy0K98HDtfE10mhUsrRWVE2791zvo9k6TnUQIPkOhWwlKlIuKZ5Kx7do S7+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=QwYlChfbrpLu0LW5e2tcCE5UCRdfxp+7b94EY+A7IjQ=; b=itE2O1P3S9qFKfLwDynpRgdTezfCrBbHW41Tch8xr5UylCSCd5BBXd2HQzByaa6gDI uZjUz927CSMh0qydE5aPFkPd6PJxbwX4sK/XapXviVcv/2GFN4p7aZ7BgU5UnVBtr8AO S4hSngl2mesKvRCRvkj9XNjtreZCSBHd6+iIiqCzCY+df189CDP8vfYovyBozY9RQ7F2 SY2zwgCJONAkNH6nKWQkyXf9VQMRj8pfiPKz4cLwNilOBhP8QVL4/OaMwBmBdvGkvsNQ YaJf+aj8np5Y91TxssvWb8yV+3PZBZI//Vn0G25Q8B3jX2Q7FoH8VVWgeMcGaN8oWiJP 6lhg== X-Gm-Message-State: APjAAAXYcJ0f0O5IR4tqluyb4dPOfpVmyALOalMMy5YhSGRLZofLIBRZ pOwU0R7Vjvdi2eyHz8qOTCM= X-Google-Smtp-Source: APXvYqzzVeNA7d6v4KeSRywgGqSNN901swg2i7H6WqHh2gx9Lcq0E7Kb+AzRTvBiKHjwDcuJgRogGw== X-Received: by 2002:adf:f005:: with SMTP id j5mr101718339wro.251.1564824209833; Sat, 03 Aug 2019 02:23:29 -0700 (PDT) Original-Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id c4sm63100249wrt.86.2019.08.03.02.23.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 03 Aug 2019 02:23:29 -0700 (PDT) In-Reply-To: <20190803095056.75166d14@ventiloplattform.tastytea.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164422 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=E2=80=A6 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=whitespace.diff 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 \ --=-=-=--