Emacs23在Ubuntu(Gnome 3)中不能透明

时间:2012-03-16 11:14:28

标签: emacs transparent

我搜索如何透明我的emacs窗口。但它不起作用。 这样的事情失败了:

 (global-set-key [(f8)] 'loop-alpha)

 (setq alpha-list '((100 100) (95 65) (85 55) (75 45) (65 35)))

(defun loop-alpha ()
(interactive)
(let ((h (car alpha-list)))               
((lambda (a ab)
   (set-frame-parameter (selected-frame) 'alpha (list a ab))
   (add-to-list 'default-frame-alist (cons 'alpha (list a ab)))
   ) (car h) (car (cdr h)))
(setq alpha-list (cdr (append alpha-list (list h))))
)
)

1 个答案:

答案 0 :(得分:0)

这是我认为您尝试做的工作实施:

(global-set-key [(f8)] 'loop-alpha)

(defvar alpha-list '((100 100) (95 65) (85 55) (75 45) (65 35)))

(defun next-alpha ()
  (let ((current-alpha
         (or (frame-parameter (selected-frame) 'alpha)
             (first alpha-list)))
        (lst alpha-list))
    (or (second
         (catch 'alpha
           (while lst
             (when (equal (first lst) current-alpha)
               (throw 'alpha lst))
             (setf lst (cdr lst)))))
        (first alpha-list))))

(defun loop-alpha ()
  (interactive)
  (let ((new-alpha (next-alpha))
        (current-default (assoc 'alpha default-frame-alist)))
    (set-frame-parameter (selected-frame) 'alpha new-alpha)
    (if current-default
        (setcdr current-default new-alpha)
      (add-to-list 'default-frame-alist (cons 'alpha new-alpha)))))

请注意,您编写的任何重新定义alpha-list的版本对多个帧都会表现得非常奇怪。我会解释你的代码有什么问题,但老实说我无法解决它应该做的事情。请注意,如果我首先允许自己(require 'cl),这会更容易编写,但我认为这段代码应该可行 - 它无论如何都可以在这里完成!