unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18732: [PATCH] whitespace-mode: add 'many-tabs style highlighting multiple TABs
@ 2014-10-15 12:14 Michal Nazarewicz
  2014-10-16 13:07 ` Ted Zlatanov
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Nazarewicz @ 2014-10-15 12:14 UTC (permalink / raw)
  To: 18732

Add a 'many-tabs style to `whitespace-mode' designed to be used
in conjunction with 'tab style to indicate when indention level
is getting too big.  By default, four TABs are considered many
but `whitespace-many-tabs-regexp' can be configured to change
that.
---
 etc/NEWS           |  6 ++++++
 lisp/ChangeLog     |  8 ++++++++
 lisp/whitespace.el | 43 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index e336ff5..a1da2065 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -238,6 +238,12 @@ 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 'many-tabs style highlighting sequences of multiple
+TAB characters.  Designed to be used in conjunction with 'tab style to
+indicate when indention level is getting too big.  By default, four
+TABs are considered many but `whitespace-many-tabs-regexp' can be
+configured to change that.
+
 ** Obsolete packages
 
 ---
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6916143..e00e77b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-10-15  Michal Nazarewicz  <mina86@mina86.com>
+
+	* whitespace.el: Add 'many-tabs style highlighting sequences of
+	multiple TAB characters.  Designed to be used in conjunction with
+	'tab style to indicate when indention level is getting too big.
+	By default, four TABs are considered many but
+	`whitespace-many-tabs-regexp' can be configured to change that.
+
 2014-10-15  Eli Zaretskii  <eliz@gnu.org>
 
 	* emacs-lisp/tabulated-list.el (tabulated-list-mode): Force
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 917f043..9fa3f95 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -252,6 +252,8 @@
 ;;
 ;; `whitespace-tab'		Face used to visualize TAB.
 ;;
+;; `whitespace-many-tabs'	Face used to visualize sequences of many TABs.
+;;
 ;; `whitespace-newline'		Face used to visualize NEWLINE char
 ;;				mapping.
 ;;
@@ -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
@@ -402,6 +406,11 @@ 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'.
 
+   many-tabs		Sequence of multiple TABs (at least 4 by
+                        default) are visualized via faces.
+			It has effect only if `face' (see above)
+			is present in `whitespace-style'.
+
    spaces		SPACEs and HARD SPACEs are visualized via
 			faces.
 			It has effect only if `face' (see above)
@@ -538,6 +547,7 @@ See also `whitespace-display-mappings' for documentation."
 			 (const :tag "(Face) SPACEs and HARD SPACEs"
 				spaces)
 			 (const :tag "(Face) TABs" tabs)
+			 (const :tag "(Face) Many TABs" many-tabs)
 			 (const :tag "(Face) Lines" lines)
 			 (const :tag "(Face) SPACEs before TAB"
 				space-before-tab)
@@ -599,6 +609,15 @@ Used when `whitespace-style' includes the value `tabs'.")
   "Face used to visualize TAB."
   :group 'whitespace)
 
+(defface whitespace-many-tabs
+  '((((class color) (background dark))
+     :background "grey32" :foreground "darkgray")
+    (((class color) (background light))
+     :background "wheat"  :foreground "lightgray")
+    (t :inverse-video t))
+  "Face used to visualize sequence of several TABs in a row."
+  :group 'whitespace)
+
 
 (defvar whitespace-newline 'whitespace-newline
   "Symbol face used to visualize NEWLINE char mapping.
@@ -765,6 +784,19 @@ Used when `whitespace-style' includes `tabs'."
   :type '(regexp :tag "TAB Chars")
   :group 'whitespace)
 
+(defcustom whitespace-many-tabs-regexp "\\(\t\\{4,\\}\\)"
+  "Specify many TAB characters 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 `many-tabs'."
+  :type '(regexp :tag "TAB Chars")
+  :group 'whitespace)
+
 
 (defcustom whitespace-trailing-regexp
   "\\([\t \u00A0]+\\)$"
@@ -1132,6 +1164,7 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
 (defconst whitespace-style-value-list
   '(face
     tabs
+    many-tabs
     spaces
     trailing
     lines
@@ -1158,6 +1191,7 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
 (defconst whitespace-toggle-option-alist
   '((?f    . face)
     (?t    . tabs)
+    (?\C-t . many-tabs)
     (?s    . spaces)
     (?r    . trailing)
     (?l    . lines)
@@ -1241,6 +1275,7 @@ Interactively, it reads one of the following chars:
   (VIA FACES)
    f	toggle face visualization
    t	toggle TAB visualization
+   C-t	toggle many TABs visualization
    s	toggle SPACE and HARD SPACE visualization
    r	toggle trailing blanks visualization
    l	toggle \"long lines\" visualization
@@ -1270,6 +1305,7 @@ The valid symbols are:
 
    face			toggle face visualization
    tabs			toggle TAB visualization
+   many-tabs		toggle many TABs visualization
    spaces		toggle SPACE and HARD SPACE visualization
    trailing		toggle trailing blanks visualization
    lines		toggle \"long lines\" visualization
@@ -1320,6 +1356,7 @@ Interactively, it accepts one of the following chars:
   (VIA FACES)
    f	toggle face visualization
    t	toggle TAB visualization
+   C-t	toggle many TABs visualization
    s	toggle SPACE and HARD SPACE visualization
    r	toggle trailing blanks visualization
    l	toggle \"long lines\" visualization
@@ -1349,6 +1386,7 @@ The valid symbols are:
 
    face			toggle face visualization
    tabs			toggle TAB visualization
+   many-tabs		toggle many TABs visualization
    spaces		toggle SPACE and HARD SPACE visualization
    trailing		toggle trailing blanks visualization
    lines		toggle \"long lines\" visualization
@@ -1847,6 +1885,7 @@ cleaning up these problems."
  FACES                                      \\__________________________/
  []  f   - toggle face visualization
  []  t   - toggle TAB visualization
+ []  C-t - toggle many TABs visualization
  []  s   - toggle SPACE and HARD SPACE visualization
  []  r   - toggle trailing blanks visualization
  []  l   - toggle \"long lines\" visualization
@@ -2100,6 +2139,7 @@ resultant list will be returned."
   "Return t if there is some visualization via face."
   (and (memq 'face whitespace-active-style)
        (or (memq 'tabs                    whitespace-active-style)
+           (memq 'many-tabs               whitespace-active-style)
 	   (memq 'spaces                  whitespace-active-style)
 	   (memq 'trailing                whitespace-active-style)
 	   (memq 'lines                   whitespace-active-style)
@@ -2149,6 +2189,9 @@ resultant list will be returned."
        ,@(when (memq 'tabs whitespace-active-style)
            ;; Show TABs.
            `((,whitespace-tab-regexp 1 whitespace-tab t)))
+       ,@(when (memq 'many-tabs whitespace-active-style)
+           ;; Show many TABs.
+           `((,whitespace-many-tabs-regexp 1 'whitespace-many-tabs t)))
        ,@(when (memq 'trailing whitespace-active-style)
            ;; Show trailing blanks.
            `((,#'whitespace-trailing-regexp 1 whitespace-trailing t)))






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#18732: [PATCH] whitespace-mode: add 'many-tabs style highlighting multiple TABs
  2014-10-15 12:14 bug#18732: [PATCH] whitespace-mode: add 'many-tabs style highlighting multiple TABs Michal Nazarewicz
@ 2014-10-16 13:07 ` Ted Zlatanov
  2014-10-17  7:39   ` bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention Michal Nazarewicz
  0 siblings, 1 reply; 10+ messages in thread
From: Ted Zlatanov @ 2014-10-16 13:07 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

On Wed, 15 Oct 2014 14:14:06 +0200 Michal Nazarewicz <mina86@mina86.com> wrote: 

MN> Add a 'many-tabs style to `whitespace-mode' designed to be used
MN> in conjunction with 'tab style to indicate when indention level
MN> is getting too big.  By default, four TABs are considered many
MN> but `whitespace-many-tabs-regexp' can be configured to change
MN> that.

I like the feature, but for source files without tabs, it wouldn't work
well, right? Maybe it should also support too much space (32 spaces by
defaults)? And I think it should be called 'too-much-indent or something
like that, because it's not about highlighting tabs per se.

Ted





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-16 13:07 ` Ted Zlatanov
@ 2014-10-17  7:39   ` Michal Nazarewicz
  2014-10-17 12:56     ` Ted Zlatanov
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Nazarewicz @ 2014-10-17  7:39 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: 18732

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





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17  7:39   ` bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention Michal Nazarewicz
@ 2014-10-17 12:56     ` Ted Zlatanov
  2014-10-17 13:16       ` bug#18732: [PATCHv3] " Michal Nazarewicz
  2014-10-17 17:03       ` bug#18732: [PATCH] " Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Ted Zlatanov @ 2014-10-17 12:56 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

On Fri, 17 Oct 2014 09:39:42 +0200 Michal Nazarewicz <mina86@mina86.com> wrote: 

MN> Add a 'big-indent style to `whitespace-mode' indicating when indention
MN> level is getting too big.  By default, 32 spaces and four TABs are
MN> considered to be a big indention but `whitespace-many-tabs-regexp' can
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The regexp var was renamed to `whitespace-big-indent-regexp' so the
above note needs changing.

MN> +;; `whitespace-tab-regexp'	Specify many TAB characters regexp.
MN> +;;

Copy+paste bug.

MN> +			 (const :tag "(Face) Big indentation" big-indent)

Maybe "Too much line indentation" would be a better user-facing tag.

MN> +(defcustom whitespace-big-indent-regexp
...
MN> +  :type '(regexp :tag "Big indention")

Typo in tag, and maybe reword to "Detect too much indentation at the beginning of a line".

MN> + []  C-t - toggle big indention visualization

Typo.

Looks good otherwise, I can't wait to start using it!  Thanks for
working on it.

Ted





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 12:56     ` Ted Zlatanov
@ 2014-10-17 13:16       ` Michal Nazarewicz
  2014-10-17 17:16         ` Ted Zlatanov
  2014-10-17 17:18         ` Ted Zlatanov
  2014-10-17 17:03       ` bug#18732: [PATCH] " Stefan Monnier
  1 sibling, 2 replies; 10+ messages in thread
From: Michal Nazarewicz @ 2014-10-17 13:16 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: 18732

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 many but `whitespace-big-indent-regexp'
can be configured to change that.
---
 etc/NEWS           |  4 ++++
 lisp/whitespace.el | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index bfa8002..59af17a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -258,6 +258,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 indentation.
+By default, 32 spaces and four TABs are considered to be a big indentation 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..f2e7e39 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 indentation.
+;;
 ;; `whitespace-empty'		Face used to visualize empty lines at
 ;;				beginning and/or end of buffer.
 ;;
@@ -286,6 +288,9 @@
 ;; `whitespace-indentation-regexp'	Specify regexp for 8 or more
 ;;					SPACEs at beginning of line.
 ;;
+;; `whitespace-tab-regexp'	Specify big indentation at beginning of line
+;;				regexp.
+;;
 ;; `whitespace-empty-at-bob-regexp'	Specify regexp for empty lines
 ;;					at beginning of buffer.
 ;;
@@ -452,6 +457,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 indentations 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 +553,8 @@ See also `whitespace-display-mappings' for documentation."
 			 (const :tag "(Face) NEWLINEs" newline)
 			 (const :tag "(Face) Indentation SPACEs"
 				indentation)
+			 (const :tag "(Face) Too much line indentation"
+				big-indent)
 			 (const :tag "(Face) Empty Lines At BOB And/Or EOB"
 				empty)
 			 (const :tag "(Face) SPACEs after TAB"
@@ -673,6 +684,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 +855,20 @@ Used when `whitespace-style' includes `space-after-tab',
 	       string)
   :group 'whitespace)
 
+(defcustom whitespace-big-indent-regexp
+  "^\\(\\(?:\t\\{4,\\}\\| \\{32,\\}\\)[\t ]*\\)"
+  "Specify big indentation 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 "Detect too much indentation at the beginning of a line")
+  :group 'whitespace)
+
 
 (defcustom whitespace-line-column 80
   "Specify column beyond which the line is highlighted.
@@ -1141,6 +1172,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 +1199,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 +1283,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 indentation 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 +1313,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 +1364,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 indentation 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 +1394,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 +1893,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 indentation 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 +2147,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 +2235,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
-- 
2.1.0.rc2.206.gedb03e5






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 12:56     ` Ted Zlatanov
  2014-10-17 13:16       ` bug#18732: [PATCHv3] " Michal Nazarewicz
@ 2014-10-17 17:03       ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2014-10-17 17:03 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

> Maybe "Too much line indentation" would be a better user-facing tag.

Or "Indentation too deep".


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 13:16       ` bug#18732: [PATCHv3] " Michal Nazarewicz
@ 2014-10-17 17:16         ` Ted Zlatanov
  2014-10-17 17:18         ` Ted Zlatanov
  1 sibling, 0 replies; 10+ messages in thread
From: Ted Zlatanov @ 2014-10-17 17:16 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

On Fri, 17 Oct 2014 15:16:38 +0200 Michal Nazarewicz <mina86@mina86.com> wrote: 

MN> +;; `whitespace-tab-regexp'	Specify big indentation at beginning of line
MN> +;;				regexp.
MN> +;;

Almost perfect, except for this s/tab/big-indent/ I think.

Ted





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 13:16       ` bug#18732: [PATCHv3] " Michal Nazarewicz
  2014-10-17 17:16         ` Ted Zlatanov
@ 2014-10-17 17:18         ` Ted Zlatanov
  2014-10-17 18:04           ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Ted Zlatanov @ 2014-10-17 17:18 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

On Fri, 17 Oct 2014 15:16:38 +0200 Michal Nazarewicz <mina86@mina86.com> wrote: 

MN> Add a 'big-indent style to `whitespace-mode' indicating when
MN> indention level is getting too big.  By default, 32 SPACEs and
MN> four TABs are considered many but `whitespace-big-indent-regexp'
MN> can be configured to change that.

Stefan, do you want to push this to trunk or should I?  I think it's
ready but for the one minor typo I noted.

Ted





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 17:18         ` Ted Zlatanov
@ 2014-10-17 18:04           ` Stefan Monnier
  2014-10-18  0:25             ` Ted Zlatanov
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2014-10-17 18:04 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: 18732

> Stefan, do you want to push this to trunk or should I?  I think it's
> ready but for the one minor typo I noted.

Please do it,


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention
  2014-10-17 18:04           ` Stefan Monnier
@ 2014-10-18  0:25             ` Ted Zlatanov
  0 siblings, 0 replies; 10+ messages in thread
From: Ted Zlatanov @ 2014-10-18  0:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michal Nazarewicz, 18732-done

On Fri, 17 Oct 2014 14:04:55 -0400 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

>> Stefan, do you want to push this to trunk or should I?  I think it's
>> ready but for the one minor typo I noted.

SM> Please do it,

OK; done.  Michal, I did a little bit of editing here and there but the
code needed nothing.  I tested it a bit before pushing.

Ted

------------------------------------------------------------
revno: 118144
author: Michal Nazarewicz <mina86@mina86.com>
committer: Ted Zlatanov <tzz@lifelogs.com>
branch nick: quickfixes
timestamp: Fri 2014-10-17 20:23:03 -0400
message:
  Add a 'big-indent style to `whitespace-mode'.
  
  * lisp/whitespace.el (whitespace-style, whitespace-big-indent)
  (whitespace-big-indent-regexp, whitespace-style-value-list)
  (whitespace-toggle-option-alist, whitespace-interactive-char)
  (whitespace-toggle-options)
  (global-whitespace-toggle-options, whitespace-help-text)
  (whitespace-style-face-p, whitespace-color-on): Add a 'big-indent
  style to `whitespace-mode' to indicate that the line indentation
  is too deep.  By default, 32 SPACEs or four TABs are considered
  too many but `whitespace-big-indent-regexp' can be configured.
------------------------------------------------------------
revno: 118143
author: Michal Nazarewicz <mina86@mina86.com>
committer: Ted Zlatanov <tzz@lifelogs.com>
branch nick: quickfixes
timestamp: Fri 2014-10-17 20:22:13 -0400
message:
  Mention new whitespace-mode option: big-indent.
  
  * etc/NEWS: Mention new whitespace-mode option: big-indent.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-10-18  0:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15 12:14 bug#18732: [PATCH] whitespace-mode: add 'many-tabs style highlighting multiple TABs Michal Nazarewicz
2014-10-16 13:07 ` Ted Zlatanov
2014-10-17  7:39   ` bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention Michal Nazarewicz
2014-10-17 12:56     ` Ted Zlatanov
2014-10-17 13:16       ` bug#18732: [PATCHv3] " Michal Nazarewicz
2014-10-17 17:16         ` Ted Zlatanov
2014-10-17 17:18         ` Ted Zlatanov
2014-10-17 18:04           ` Stefan Monnier
2014-10-18  0:25             ` Ted Zlatanov
2014-10-17 17:03       ` bug#18732: [PATCH] " Stefan Monnier

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).