From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55980: 29.0.50; [PATCH] whitespace.el: New whitespace style `lines-char' Date: Tue, 14 Jun 2022 21:08:54 +0200 Message-ID: <865yl3kqpl.fsf@miha-pc> Reply-To: miha@kamnitnik.top Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16163"; mail-complaints-to="usenet@ciao.gmane.io" To: 55980@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 14 20:58:37 2022 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 1o1BkL-00041a-55 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 20:58:37 +0200 Original-Received: from localhost ([::1]:37232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1BkJ-000134-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 14:58:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1Bjm-00012s-81 for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 14:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1Bjl-0005FF-W5 for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 14:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o1Bjl-0005RX-T4 for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 14:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: miha@kamnitnik.top Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Jun 2022 18:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55980 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165523302420851 (code B ref -1); Tue, 14 Jun 2022 18:58:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jun 2022 18:57:04 +0000 Original-Received: from localhost ([127.0.0.1]:35788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1Bip-0005QF-UF for submit@debbugs.gnu.org; Tue, 14 Jun 2022 14:57:04 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1Bin-0005Px-Kx for submit@debbugs.gnu.org; Tue, 14 Jun 2022 14:57:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1Bij-0000yJ-VY for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 14:56:59 -0400 Original-Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:58884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1Bih-0005AL-Pc for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 14:56:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1655233013; bh=eDOUT0qr6B5R8eWObskhDZe+TS4srWL6WBGQ3cg2WlY=; h=From:To:Subject:Date:From; b=fK/m8r74AdHhe2OWuRf+nUa6ra9Pc85cU1kEyrkkgZEvqysd+mGp26ROc7u2n3AHR XSNxHDOckE+ab1dgOzFvrzbA+LR8ZJyi0SbC16jAwaCbCrF4B5odMHL0km09Gb/ZM5 KF/7kvDHE4JfrkkH1FPu25Q1ylCcKkKlqU7l1C3T+p+d3P2QKAElREhlaOzTkzbaZg 9phSQ/MShobudoywgnzQYUSPp0mXBKZYIYlDdiUL+qf1h/sHMU5XQBjbFzviPDOkPD nN64uU+dCsIAobGmHhLSyiSYLeKTOK/CT9ntA7ujiNOO+b0+lmsAYZrEU7lSni3rUI SHSiLQ7OMtl9w== Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626; envelope-from=miha@kamnitnik.top; helo=kamnitnik.top X-Spam_score_int: 24 X-Spam_score: 2.4 X-Spam_bar: ++ X-Spam_report: (2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=1.997, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:234534 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Please see the attached patch which adds a new whitespace style to highlight only the first character over the whitespace-line-column limit. Best regards. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-whitespace.el-New-whitespace-style-lines-char.patch Content-Transfer-Encoding: quoted-printable From=20d1c341e46206e7ce1615105cf6a0e70aebbc72e4 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Tue, 14 Jun 2022 21:02:22 +0200 Subject: [PATCH] whitespace.el: New whitespace style `lines-char' * lisp/whitespace.el (whitespace-style): (whitespace-style-value-list): (whitespace-toggle-option-alist): (global-whitespace-toggle-options): (whitespace-help-text): (whitespace-interactive-char): (whitespace-style-face-p): (whitespace-color-on): (whitespace-lines-regexp): New whitespace style `lines-char', which highlights only the first character over the whitespace-line-column limit. =2D-- lisp/whitespace.el | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 610d670ac9..a974336ace 100644 =2D-- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -295,8 +295,8 @@ whitespace-style `whitespace-line-column' are highlighted via faces. Whole line is highlighted. =2D It has precedence over `lines-tail' (see =2D below). + It has precedence over `lines-tail' and + `lines-char' (see below). It has effect only if `face' (see above) is present in `whitespace-style'. =20 @@ -310,6 +310,17 @@ whitespace-style and if `face' (see above) is present in `whitespace-style'. =20 + lines-char lines which have columns beyond + `whitespace-line-column' are highlighted via + faces. + But only the first character which goes + beyond `whitespace-line-column' column. + It has effect only if `lines' or + `lines-tail' (see above) + is not present in `whitespace-style' + and if `face' (see above) is present in + `whitespace-style'. + newline NEWLINEs are visualized via faces. It has effect only if `face' (see above) is present in `whitespace-style'. @@ -431,6 +442,7 @@ whitespace-style (const :tag "(Face) SPACEs and HARD SPACEs" spaces) (const :tag "(Face) Lines" lines) (const :tag "(Face) Lines, only overlong part" lines-tail) + (const :tag "(Face) Lines, only first character" lines-char) (const :tag "(Face) NEWLINEs" newline) (const :tag "(Face) Missing newlines at EOB" missing-newline-at-eof) @@ -772,7 +784,8 @@ whitespace-line-column It must be an integer or nil. If nil, the `fill-column' variable value is used. =20 =2DUsed when `whitespace-style' includes `lines' or `lines-tail'." +Used when `whitespace-style' includes `lines', `lines-tail' or +`lines-char'." :type '(choice :tag "Line Length Limit" (integer :tag "Line Length") (const :tag "Use fill-column" nil)) @@ -1058,6 +1071,7 @@ whitespace-style-value-list trailing lines lines-tail + lines-char newline empty indentation @@ -1085,6 +1099,7 @@ whitespace-toggle-option-alist (?r . trailing) (?l . lines) (?L . lines-tail) + (?\C-l . lines-char) (?n . newline) (?e . empty) (?\C-i . indentation) @@ -1244,6 +1259,7 @@ global-whitespace-toggle-options r toggle trailing blanks visualization l toggle \"long lines\" visualization L toggle \"long lines\" tail visualization + C-l toggle \"long lines\" one character visualization n toggle NEWLINE visualization e toggle empty line at bob and/or eob visualization C-i toggle indentation SPACEs visualization (via `indent-tabs-mode') @@ -1274,6 +1290,7 @@ global-whitespace-toggle-options trailing toggle trailing blanks visualization lines toggle \"long lines\" visualization lines-tail toggle \"long lines\" tail visualization + lines-char toggle \"long lines\" one character visualization newline toggle NEWLINE visualization empty toggle empty line at bob and/or eob visualization indentation toggle indentation SPACEs visualization @@ -1770,6 +1787,7 @@ whitespace-help-text [] r - toggle trailing blanks visualization [] l - toggle \"long lines\" visualization [] L - toggle \"long lines\" tail visualization + [] C-l - toggle \"long lines\" one character visualization [] n - toggle NEWLINE visualization [] e - toggle empty line at bob and/or eob visualization [] C-i - toggle indentation SPACEs visualization (via `indent-tabs-mode') @@ -1892,6 +1910,7 @@ whitespace-interactive-char r toggle trailing blanks visualization l toggle \"long lines\" visualization L toggle \"long lines\" tail visualization + C-l toggle \"long lines\" one character visualization n toggle NEWLINE visualization e toggle empty line at bob and/or eob visualization C-i toggle indentation SPACEs visualization (via `indent-tabs-mode') @@ -2020,6 +2039,7 @@ whitespace-style-face-p (memq 'trailing whitespace-active-style) (memq 'lines whitespace-active-style) (memq 'lines-tail whitespace-active-style) + (memq 'lines-char whitespace-active-style) (memq 'newline whitespace-active-style) (memq 'empty whitespace-active-style) (memq 'indentation whitespace-active-style) @@ -2066,12 +2086,17 @@ whitespace-color-on ;; Show trailing blanks. `((,#'whitespace-trailing-regexp 1 whitespace-trailing t))) ,@(when (or (memq 'lines whitespace-active-style) =2D (memq 'lines-tail whitespace-active-style)) + (memq 'lines-tail whitespace-active-style) + (memq 'lines-char whitespace-active-style)) ;; Show "long" lines. `((,#'whitespace-lines-regexp =2D ,(if (memq 'lines whitespace-active-style) =2D 0 ; whole line =2D 2) ; line tail + ,(cond + ;; whole line + ((memq 'lines whitespace-active-style) 0) + ;; line tail + ((memq 'lines-tail whitespace-active-style) 2) + ;; first overflowing character + ((memq 'lines-char whitespace-active-style) 3)) whitespace-line prepend))) ,@(when (or (memq 'space-before-tab whitespace-active-style) (memq 'space-before-tab::tab whitespace-active-style) @@ -2182,7 +2207,7 @@ whitespace-lines-regexp (re-search-forward (let ((line-column (or whitespace-line-column fill-column))) (format =2D "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" + "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(?2:\\(?3:.= \\).*\\)$" tab-width (1- tab-width) (/ line-column tab-width) =2D-=20 2.36.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmKo3MYTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP8C7D/9LgBRzVLGZFbPRKVSUSgk3zd9p9W0Y 5wVpV5BD7ZnDk4nlJ0WSWZpV+J3P7GwHOwGxYEGwCT5AvZ3OXBNd5oiS+W+DDb6Y ixvM+N8nHiExhh0VQtVFL6xbYkPIGBa7HPCvnL/+6LWOA/Y6Eu8Gt8p2GOxep8yZ etmJffwBNxZtGS0esScib0fvdBJgFnS7dpxWsb/oNA3mRHSxiK9we/53UY6rrjcj yKvKz5RlBcLfuKgQ8I6+ZgCB9qaR7trZtoG8+N7vXkTDy5OCVlZRMY5fRUZCCI/y IIyeoGNWvbimAyZLXZSt9VgRZv6Vmuj/u5NKiydpgydzuf+0ergi1NV26e8hlWi6 cTIgdzZSQFN+KFfSyONVjAINwhYa5b0rF6jjXu3ee7aHzos4wqlENdEhDkI96Ape TNnd06qaLbgjBe+LbSxqzOA8IXRY4VxvjJumGBX8kCI/ShATrstZewh9cJxS7LYw ZNCArDSszr28ZfScBbwGSH1tVH7xQ5b9Of4gqGOKjoPzR5fPA9rlRJ1dPWUAuehn vo2PNhjx5YpdnUBU2Nivqvy5wANEsaBBOkaU7NSqQfmLD2gfshauND81v1WwW2Pp Dok1oE30e1Ca4WlMB3Z/jp1qW69zZhg8i5SgvaKzAojgPhacpZo0Bt2/x5HvzPNN 5czxxLiQLg72Cg== =N2VA -----END PGP SIGNATURE----- --==-=-=--