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." "Toggle between transparent or opaque display."
(interactive) (interactive)
(let* ((frame (selected-frame)) (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 (set-frame-parameter
frame 'alpha frame 'alpha
(if (or (null alpha) (= (cdr-safe alpha) 100)) (if (not (equal alpha dotfile-setting))
(cons dotspacemacs-active-transparency dotfile-setting
dotspacemacs-inactive-transparency)
'(100 . 100)))) '(100 . 100))))
;; Immediately enter the micro-state, but also keep toggle ;; Immediately enter the micro-state, but also keep toggle
;; accessible from helm-spacemacs ;; accessible from helm-spacemacs