emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master aaf199e 006/271: Fix global wraparound.


From: Jackson Ray Hamilton
Subject: [elpa] master aaf199e 006/271: Fix global wraparound.
Date: Thu, 05 Feb 2015 18:29:22 +0000

branch: master
commit aaf199e81ce7c7372a149a12f3c7f9fa5604b9be
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Fix global wraparound.
---
 context-coloring.el    |   11 ++++++++++-
 test/fixtures/depth.js |   23 +++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 29eb00e..6fc2545 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -112,7 +112,16 @@ Determines depth at which to cycle through faces again.")
 For example: 'context-coloring-depth-1-face'."
   (intern-soft
    (concat "context-coloring-depth-"
-           (number-to-string (mod depth context-coloring-face-count))
+           (number-to-string
+            (or
+             ;; Has a face directly mapping to it.
+             (and (< depth context-coloring-face-count)
+                  depth)
+             ;; After the number of available faces are used up, pretend the 
0th
+             ;; face doesn't exist.
+             (+ 1
+                (mod (- depth 1)
+                     (- context-coloring-face-count 1)))))
            "-face")))
 
 (defconst context-coloring-path
diff --git a/test/fixtures/depth.js b/test/fixtures/depth.js
new file mode 100644
index 0000000..107d8ca
--- /dev/null
+++ b/test/fixtures/depth.js
@@ -0,0 +1,23 @@
+function a() {
+    function b() {
+        function c() {
+            function d() {
+                function e() {
+                    function f() {
+                        function g() {
+                            function h() {
+                                function i() {
+                                    function j() {
+                                        function k() {
+
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}



reply via email to

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