transparency: Better version of toggle transparency

Before we could get an error if for some reason the user set the alpha
parameter to something other than a cons cell.

Ref #4388
This commit is contained in:
justbur 2016-01-05 11:26:47 -05:00 committed by syl20bnr
parent cddf18ff1e
commit f3c650472c

View file

@ -555,12 +555,13 @@ otherwise it is scaled down."
"Toggle between transparent or opaque display."
(interactive)
(let* ((frame (selected-frame))
(alpha (frame-parameter frame 'alpha)))
(alpha (frame-parameter frame 'alpha))
(dotfile-setting (cons dotspacemacs-active-transparency
dotspacemacs-inactive-transparency)))
(set-frame-parameter
frame 'alpha
(if (or (null alpha) (= (cdr-safe alpha) 100))
(cons dotspacemacs-active-transparency
dotspacemacs-inactive-transparency)
(if (not (equal alpha dotfile-setting))
dotfile-setting
'(100 . 100))))
;; Immediately enter the micro-state, but also keep toggle
;; accessible from helm-spacemacs