emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b6d4baf 1/2: Handle pulse-background being nil


From: Stephen Leake
Subject: [Emacs-diffs] master b6d4baf 1/2: Handle pulse-background being nil
Date: Sat, 15 Aug 2015 17:20:25 +0000

branch: master
commit b6d4bafa1de2aa3ae2bb8cba5825d4a6f248ed0a
Author: Stephen Leake <address@hidden>
Commit: Stephen Leake <address@hidden>

    Handle pulse-background being nil
    
    * lisp/cedet/pulse.el (pulse-lighten-highlight): Inherit
    pulse-background, handle it being nil.
---
 lisp/cedet/pulse.el |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index 39ba13c..dea73a0 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -131,25 +131,28 @@ Return t if there is more drift to do, nil if completed."
   (if (>= (get 'pulse-highlight-face :iteration) pulse-iterations)
       nil
     (let* ((frame (color-values (face-background 'default)))
-          (start (color-values (face-background
-                                (get 'pulse-highlight-face
-                                     :startface)
-                                 nil t)))
-          (frac  (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations)
-                       (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations)
-                       (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations)))
-          (it (get 'pulse-highlight-face :iteration))
-          )
-      (set-face-background 'pulse-highlight-face
-                          (pulse-color-values-to-hex
-                           (list
-                            (+ (nth 0 start) (* (nth 0 frac) it))
-                            (+ (nth 1 start) (* (nth 1 frac) it))
-                            (+ (nth 2 start) (* (nth 2 frac) it)))))
-      (put 'pulse-highlight-face :iteration (1+ it))
-      (if (>= (1+ it) pulse-iterations)
-         nil
-       t))))
+          (pulse-background (face-background
+                             (get 'pulse-highlight-face
+                                  :startface)
+                              nil t)));; can be nil
+      (when pulse-background
+       (let* ((start (color-values pulse-background))
+              (frac  (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations)
+                           (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations)
+                           (/ (- (nth 2 frame) (nth 2 start)) 
pulse-iterations)))
+              (it (get 'pulse-highlight-face :iteration))
+              )
+         (set-face-background 'pulse-highlight-face
+                              (pulse-color-values-to-hex
+                               (list
+                                (+ (nth 0 start) (* (nth 0 frac) it))
+                                (+ (nth 1 start) (* (nth 1 frac) it))
+                                (+ (nth 2 start) (* (nth 2 frac) it)))))
+         (put 'pulse-highlight-face :iteration (1+ it))
+         (if (>= (1+ it) pulse-iterations)
+             nil
+           t)))
+      )))
 
 (defun pulse-reset-face (&optional face)
   "Reset the pulse highlighting FACE."



reply via email to

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