From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!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: Mon, 24 Feb 2020 21:12:03 +0100 Message-ID: <87zhd7219o.fsf@gmail.com> References: <20190729111756.0665feb6@ventiloplattform.tastytea.de> <87k1bvfwda.fsf@gmail.com> <20190803095056.75166d14@ventiloplattform.tastytea.de> <87imrebo1c.fsf@gmail.com> <85imjvahee.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="128863"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: tastytea , 36837@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 24 21:13:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6K6N-000XQa-3M for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Feb 2020 21:13:15 +0100 Original-Received: from localhost ([::1]:41696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6K6M-0008Q9-5r for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Feb 2020 15:13:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43231) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6K6B-0008ON-ID for bug-gnu-emacs@gnu.org; Mon, 24 Feb 2020 15:13:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6K6A-0005Bh-FI for bug-gnu-emacs@gnu.org; Mon, 24 Feb 2020 15:13:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48179) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6K6A-0005BR-7H for bug-gnu-emacs@gnu.org; Mon, 24 Feb 2020 15:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j6K6A-000410-1A for bug-gnu-emacs@gnu.org; Mon, 24 Feb 2020 15:13:02 -0500 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: Mon, 24 Feb 2020 20:13: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.158257512415357 (code B ref 36837); Mon, 24 Feb 2020 20:13:01 +0000 Original-Received: (at 36837) by debbugs.gnu.org; 24 Feb 2020 20:12:04 +0000 Original-Received: from localhost ([127.0.0.1]:54152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6K5E-0003zd-AE for submit@debbugs.gnu.org; Mon, 24 Feb 2020 15:12:04 -0500 Original-Received: from mail-wm1-f52.google.com ([209.85.128.52]:51234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6K5C-0003z8-EH for 36837@debbugs.gnu.org; Mon, 24 Feb 2020 15:12:02 -0500 Original-Received: by mail-wm1-f52.google.com with SMTP id t23so632941wmi.1 for <36837@debbugs.gnu.org>; Mon, 24 Feb 2020 12:12:02 -0800 (PST) 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=cm3Y5tgjQmjZve1+HRYES3ww/sz0Yr8mBKu4zTXJ7Js=; b=YpXo68NtuBjGXwus1hK4zwz2Ilf0/yQwFf68+Z5jLTZvGRPEJBsvOOyYqjImXfe8Sr RGZlcdqSCxYOZEGR9hKZ50E+YWZZTbIJWP07QmN7YYA7pvEttvvkJdKQ42GGcMUextwm co2XRsG44KWIPG2RwYvAR5PYgpkXrKJKw5eZ/xffoY9YmsJe6MSv/fN7oaGoecxKXD0P U7Rd6enMdwz50R8n2lzxnVzb7GEaWrabpAS5TAm8vXQi/L+5poCnJ4//Tx8cighdqWMb QYLuohhBSol733yfTZpOi9VkNOHGqt1wG4vZc2VtjXzRchA2BqLjEpHffFwhMkM0Vobc Lznw== 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=cm3Y5tgjQmjZve1+HRYES3ww/sz0Yr8mBKu4zTXJ7Js=; b=HMm44x9Zh0p+wPUxh4Z7lJlcpHpq3FFOks+s3htui2R4+MgHaAXxN6UZClha31w3kb gUjwooZWprJBOqKwJ+//+jjvnJkVnJWJI/qMu8H+GKXkrmvKg1rtosfaNmWjz5Wc4RuM vutBZ5rm/ugyh5VMcOcSQdpS00w9vpUqY4jjJC7YKO6SkwzdKsuzS9LOQT55qOg5R8WJ equnN8IXGD70hWPqdcwwCe0KknuGWwKQ3suFr8/ZVShWM/CgUC+badl94JTmP9cnW//K 04kfEOtsDOoPEScHkWuIZGw/BqvHRqgDyJpXXprJhu+VRZUgGRyqX0pZ5g4wG971C6f8 ZiJA== X-Gm-Message-State: APjAAAUr0xKC4KTFyGLVapj+aRssdjLDlqpadhiFXJLlwdbeB4lTME9x +Ia62+5gsYB+vbtvsrNAwEQ= X-Google-Smtp-Source: APXvYqxLFki88Bec1xK6otxNMFgPw4Jkq5Z+XO+jFGDcfdqlEV5x8Wc4QO+YpDprO9SdQvd88V8s9A== X-Received: by 2002:a1c:8095:: with SMTP id b143mr670430wmd.7.1582575116617; Mon, 24 Feb 2020 12:11:56 -0800 (PST) Original-Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id w7sm715957wmi.9.2020.02.24.12.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 12:11:55 -0800 (PST) In-Reply-To: <85imjvahee.fsf@gmail.com> 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176449 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 36837 patch thanks On Mon, 24 Feb 2020 14:56:25 -0500 Noam Postavsky wrote: >> Less avant-garde perhaps would be to do what's being done for some of >> the other regexps already: turn it into a function: > > I think this would make more sense, and also fix #39427 "whitespace-mode > doesn't track fill-column changes". FWIW, I have been running with this change ever since I suggested it. Here it is as proper patch with a commit message on top of recent master. Let me know if anything else is needed (I've been a bit out of the loop lately but I think it could still go to emacs-27, and doesn't warrant a NEWS entry?). --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-whitespace-Turn-long-lines-regexp-into-a-function-bu.patch >From a4fe6400e6a5ddf3f63d6f059058ed2abf04f1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Thu, 29 Aug 2019 19:32:08 +0200 Subject: [PATCH] whitespace: Turn long lines regexp into a function (bug#36837) * lisp/whitespace.el (whitespace-color-on): Turn long lines regexp into a function to ensure it uses current 'whitespace-line-column' and 'fill-column' values. (Bug#36837) (whitespace-lines-regexp): New function. --- lisp/whitespace.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 0137ddcf04..47434bf3d2 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2067,16 +2067,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 @@ -2177,6 +2168,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 \ -- 2.25.1 --=-=-=--