--- Begin Message ---
Subject: |
[PATCH] whitespace-mode: add 'many-tabs style highlighting multiple TABs |
Date: |
Wed, 15 Oct 2014 14:14:06 +0200 |
User-agent: |
Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Emacs/24.4.50.1 (x86_64-unknown-linux-gnu) |
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 <address@hidden>
+
+ * 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 <address@hidden>
* 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)))
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#18732: [PATCHv3] whitespace-mode: add 'big-indent style highlighting big indention |
Date: |
Fri, 17 Oct 2014 20:25:35 -0400 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
On Fri, 17 Oct 2014 14:04:55 -0400 Stefan Monnier <address@hidden> 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 <address@hidden>
committer: Ted Zlatanov <address@hidden>
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 <address@hidden>
committer: Ted Zlatanov <address@hidden>
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.
--- End Message ---