all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: 18732@debbugs.gnu.org
Subject: bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention
Date: Fri, 17 Oct 2014 09:39:42 +0200	[thread overview]
Message-ID: <xa1t4mv3kuv5.fsf@mina86.com> (raw)
In-Reply-To: <xa1th9z5lecx.fsf@mina86.com>

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





  reply	other threads:[~2014-10-17  7:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Michal Nazarewicz [this message]
2014-10-17 12:56     ` bug#18732: [PATCH] whitespace-mode: add 'big-indent style highlighting big indention 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xa1t4mv3kuv5.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=18732@debbugs.gnu.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.