From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michal Nazarewicz Newsgroups: gmane.emacs.bugs Subject: bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention Date: Fri, 17 Oct 2014 09:39:42 +0200 Organization: http://mina86.com/ Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1413531631 15344 80.91.229.3 (17 Oct 2014 07:40:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Oct 2014 07:40:31 +0000 (UTC) Cc: 18732@debbugs.gnu.org To: Ted Zlatanov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 17 09:40:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xf299-0000Xe-FZ for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Oct 2014 09:40:23 +0200 Original-Received: from localhost ([::1]:58397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xf296-0000m7-KL for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Oct 2014 03:40:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xf28w-0000lj-Gl for bug-gnu-emacs@gnu.org; Fri, 17 Oct 2014 03:40:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xf28o-00037r-Rh for bug-gnu-emacs@gnu.org; Fri, 17 Oct 2014 03:40:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xf28o-00037X-OP for bug-gnu-emacs@gnu.org; Fri, 17 Oct 2014 03:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xf28o-0004gP-7I for bug-gnu-emacs@gnu.org; Fri, 17 Oct 2014 03:40:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Michal Nazarewicz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Oct 2014 07:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18732 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 18732-submit@debbugs.gnu.org id=B18732.141353159117980 (code B ref 18732); Fri, 17 Oct 2014 07:40:02 +0000 Original-Received: (at 18732) by debbugs.gnu.org; 17 Oct 2014 07:39:51 +0000 Original-Received: from localhost ([127.0.0.1]:46533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf28b-0004fu-ED for submit@debbugs.gnu.org; Fri, 17 Oct 2014 03:39:50 -0400 Original-Received: from mail-wg0-f49.google.com ([74.125.82.49]:61414) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf28Y-0004fl-I9 for 18732@debbugs.gnu.org; Fri, 17 Oct 2014 03:39:47 -0400 Original-Received: by mail-wg0-f49.google.com with SMTP id x12so281995wgg.32 for <18732@debbugs.gnu.org>; Fri, 17 Oct 2014 00:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:organization:references:user-agent:face :date:message-id:mime-version:content-type; bh=PTpzv7/UsM+RF5Vt2J6VEjoxsRrMLqKn4iA9f/yYdEo=; b=LZDvPSIVClm+kTPjg6zS6YmxhsEsoUmXa6WYXnQAChAD32Tbe8N5CRdzrPcBdzsE6g Z0kMLYNB7PVcUCXvOTBjTc5xJdlD7Gode60cFHlga/rBuy/JoEuxsZZfXrr1MHDxXPUG q8L0HLUEKQPAh+P6cJapiCFZ7wD5HUleotxQiGXQbcRiW0JhJ6SB2LxzKEYOKmEXaX+0 pTUKNqCTioNigHTj7zWWEMUsSSIcmk890CVmqA7Gvm6x/KpF3eudY3R9l7/djD1snA6L oRK8OuEQOGIptcgpES6q/F9DWa93ofqO9C2PJEnaDggOmuT4i9O8L91zr5lno01jtdsQ Sgkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:organization :references:user-agent:face:date:message-id:mime-version :content-type; bh=PTpzv7/UsM+RF5Vt2J6VEjoxsRrMLqKn4iA9f/yYdEo=; b=cwGzANBSGb62n6DebK1Fin2mEv2nsvmZpwLF2Vb/tPFFO5LWTFcsl0Dt78TzCNeOPC 5LNe5lRG1iaC9PWFzXU271w4S/uvFXXjyOmIhlXG0VO7yP6oyXqp1arhrZEzfT3Kwhxh pPrBnPpJAs/NmfXlmkqvLEO8l5x03E/uyBQT5UUVTjGa9nWUSi6F91UOQ1eFbzTyb+xb pBNjQo+45IOFtEO/L75PZeSrNE0JpJNkgN/Yf5ikwM2V9yOeCFKukJpqcE0kCrKSZVpQ paF4Dvu7J66hDCuwoUNwrdfR+nk8DGW/ixA1BCcuWAQ5WeBf30i/8jGnrkdT8LCB20X+ mtDQ== X-Gm-Message-State: ALoCoQnjFaXFF97P24HvVpcURndyNQ7P9aUQRH8YUUKi+VRaANpqNdU7+Z5/VDmYZJBlRr5i33oa X-Received: by 10.180.211.70 with SMTP id na6mr3686381wic.3.1413531585532; Fri, 17 Oct 2014 00:39:45 -0700 (PDT) Original-Received: from mpn-glaptop.roam.corp.google.com ([62.156.150.204]) by mx.google.com with ESMTPSA id wm6sm690185wjb.5.2014.10.17.00.39.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 Oct 2014 00:39:44 -0700 (PDT) User-Agent: Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Em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ml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:141017:tzz@lifelogs.com::lo5+N8sYaVM0Bgww:04NXX X-Hashcash: 1:20:141017:18732@debbugs.gnu.org::8D3XjT5e/jVt30Fy:0000000000000000000000000000000000000000A+Sb X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94665 Add a 'big-indent style to `whitespace-mode' indicating when indention level is getting too big. By default, 32 spaces and four TABs are considered to be a big indention but `whitespace-many-tabs-regexp' can be configured to change that. --- etc/NEWS | 4 ++++ lisp/whitespace.el | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index b6d4055..08ffcc5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -253,6 +253,10 @@ name patterns (e.x. all "FOR_DOXYGEN_ONLY_*") to be excluded. *** New custom variable `tex-print-file-extension' to help users who use PDF instead of DVI. +** whitespace-mode: new 'big-indent style highlighting big indention. +By default, 32 spaces and four TABs are considered to be a big indention but +`whitespace-many-tabs-regexp' can be configured to change that. + ** Obsolete packages --- diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 917f043..f2b3198 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -266,6 +266,8 @@ ;; `whitespace-indentation' Face used to visualize 8 or more ;; SPACEs at beginning of line. ;; +;; `whitespace-big-indent' Face used to visualize big indention. +;; ;; `whitespace-empty' Face used to visualize empty lines at ;; beginning and/or end of buffer. ;; @@ -278,6 +280,8 @@ ;; ;; `whitespace-tab-regexp' Specify TAB characters regexp. ;; +;; `whitespace-tab-regexp' Specify many TAB characters regexp. +;; ;; `whitespace-trailing-regexp' Specify trailing characters regexp. ;; ;; `whitespace-space-before-tab-regexp' Specify SPACEs before TAB @@ -452,6 +456,10 @@ It's a list containing some or all of the following values: It has effect only if `face' (see above) is present in `whitespace-style'. + big-indent Big indentions are visualized via faces. + It has effect only if `face' (see above) + is present in `whitespace-style'. + space-after-tab::tab 8 or more SPACEs after a TAB are visualized via faces. It has effect only if `face' (see above) @@ -544,6 +552,7 @@ See also `whitespace-display-mappings' for documentation." (const :tag "(Face) NEWLINEs" newline) (const :tag "(Face) Indentation SPACEs" indentation) + (const :tag "(Face) Big indentation" big-indent) (const :tag "(Face) Empty Lines At BOB And/Or EOB" empty) (const :tag "(Face) SPACEs after TAB" @@ -673,6 +682,12 @@ Used when `whitespace-style' includes the value `indentation'.") "Face used to visualize 8 or more SPACEs at beginning of line." :group 'whitespace) +(defface whitespace-big-indent + '((((class mono)) :inverse-video t :weight bold :underline t) + (t :background "red" :foreground "firebrick")) + "Face used to visualize big indentation." + :group 'whitespace) + (defvar whitespace-empty 'whitespace-empty "Symbol face used to visualize empty lines at beginning and/or end of buffer. @@ -838,6 +853,20 @@ Used when `whitespace-style' includes `space-after-tab', string) :group 'whitespace) +(defcustom whitespace-big-indent-regexp + "^\\(\\(?:\t\\{4,\\}\\| \\{32,\\}\\)[\t ]*\\)" + "Specify big indention regexp. + +If you're using `mule' package, there may be other characters +besides \"\\t\" that should be considered TAB. + +NOTE: Enclose always by \\\\( and \\\\) the elements to highlight. + Use exactly one pair of enclosing \\\\( and \\\\). + +Used when `whitespace-style' includes `big-indent'." + :type '(regexp :tag "Big indention") + :group 'whitespace) + (defcustom whitespace-line-column 80 "Specify column beyond which the line is highlighted. @@ -1141,6 +1170,7 @@ See also `whitespace-newline' and `whitespace-display-mappings'." indentation indentation::tab indentation::space + big-indent space-after-tab space-after-tab::tab space-after-tab::space @@ -1167,6 +1197,7 @@ See also `whitespace-newline' and `whitespace-display-mappings'." (?\C-i . indentation) (?I . indentation::tab) (?i . indentation::space) + (?\C-t . big-indent) (?\C-a . space-after-tab) (?A . space-after-tab::tab) (?a . space-after-tab::space) @@ -1250,6 +1281,7 @@ Interactively, it reads one of the following chars: C-i toggle indentation SPACEs visualization (via `indent-tabs-mode') I toggle indentation SPACEs visualization i toggle indentation TABs visualization + C-t toggle big indention visualization C-a toggle SPACEs after TAB visualization (via `indent-tabs-mode') A toggle SPACEs after TAB: SPACEs visualization a toggle SPACEs after TAB: TABs visualization @@ -1279,6 +1311,7 @@ The valid symbols are: indentation toggle indentation SPACEs visualization indentation::tab toggle indentation SPACEs visualization indentation::space toggle indentation TABs visualization + big-indent toggle big indentation visualization space-after-tab toggle SPACEs after TAB visualization space-after-tab::tab toggle SPACEs after TAB: SPACEs visualization space-after-tab::space toggle SPACEs after TAB: TABs visualization @@ -1329,6 +1362,7 @@ Interactively, it accepts one of the following chars: C-i toggle indentation SPACEs visualization (via `indent-tabs-mode') I toggle indentation SPACEs visualization i toggle indentation TABs visualization + C-t toggle big indention visualization C-a toggle SPACEs after TAB visualization (via `indent-tabs-mode') A toggle SPACEs after TAB: SPACEs visualization a toggle SPACEs after TAB: TABs visualization @@ -1358,6 +1392,7 @@ The valid symbols are: indentation toggle indentation SPACEs visualization indentation::tab toggle indentation SPACEs visualization indentation::space toggle indentation TABs visualization + big-indent toggle big indentation visualization space-after-tab toggle SPACEs after TAB visualization space-after-tab::tab toggle SPACEs after TAB: SPACEs visualization space-after-tab::space toggle SPACEs after TAB: TABs visualization @@ -1856,6 +1891,7 @@ cleaning up these problems." [] C-i - toggle indentation SPACEs visualization (via `indent-tabs-mode') [] I - toggle indentation SPACEs visualization [] i - toggle indentation TABs visualization + [] C-t - toggle big indention visualization [] C-a - toggle SPACEs after TAB visualization (via `indent-tabs-mode') [] A - toggle SPACEs after TAB: SPACEs visualization [] a - toggle SPACEs after TAB: TABs visualization @@ -2109,6 +2145,7 @@ resultant list will be returned." (memq 'indentation whitespace-active-style) (memq 'indentation::tab whitespace-active-style) (memq 'indentation::space whitespace-active-style) + (memq 'big-indent whitespace-active-style) (memq 'space-after-tab whitespace-active-style) (memq 'space-after-tab::tab whitespace-active-style) (memq 'space-after-tab::space whitespace-active-style) @@ -2196,6 +2233,9 @@ resultant list will be returned." ;; Show indentation SPACEs (TABs). (whitespace-indentation-regexp 'space))) 1 whitespace-indentation t))) + ,@(when (memq 'big-indent whitespace-active-style) + ;; Show big indentation. + `((,whitespace-big-indent-regexp 1 'whitespace-big-indent t))) ,@(when (memq 'empty whitespace-active-style) ;; Show empty lines at beginning of buffer. `((,#'whitespace-empty-at-bob-regexp