emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118144: Add a 'big-indent style to `whitespace-mode


From: Teodor Zlatanov
Subject: [Emacs-diffs] trunk r118144: Add a 'big-indent style to `whitespace-mode'.
Date: Sat, 18 Oct 2014 00:22:15 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118144
revision-id: address@hidden
parent: address@hidden
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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/whitespace.el             
whitespace.el-20091113204419-o5vbwnq5f7feedwu-8268
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-10-17 07:28:25 +0000
+++ b/lisp/ChangeLog    2014-10-18 00:23:03 +0000
@@ -1,3 +1,15 @@
+2014-10-18  Michal Nazarewicz  <address@hidden>
+
+       * 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.
+
 2014-10-17  Michal Nazarewicz  <address@hidden>
 
        * textmodes/tildify.el (tildify--pick-alist-entry): rename from

=== modified file 'lisp/whitespace.el'
--- a/lisp/whitespace.el        2014-05-29 22:51:47 +0000
+++ b/lisp/whitespace.el        2014-10-18 00:23:03 +0000
@@ -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-big-indent-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 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 @@
                         (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 @@
   "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 @@
               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 @@
     indentation
     indentation::tab
     indentation::space
+    big-indent
     space-after-tab
     space-after-tab::tab
     space-after-tab::space
@@ -1167,6 +1199,7 @@
     (?\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 @@
    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 @@
    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 @@
    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 @@
    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 @@
  []  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 @@
           (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 @@
                  ;; 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 via email to

[Prev in Thread] Current Thread [Next in Thread]