如何设置键绑定以使 Emacs 按照我的需要透明/不透明?
我想在 Emacs 中使用一个命令将其设置为我想要的不透明/透明(请参阅精彩的 问题指出 Emacs 中可以实现透明,以及 EmacsWiki 页面链接那里有我在下面使用的代码)。
EmacsWiki 代码设置“Cc t”来打开和关闭先前设置的透明度:
;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))
(set-frame-parameter (selected-frame) 'alpha '(85 50))
(add-to-list 'default-frame-alist '(alpha 85 50))
enter code here(eval-when-compile (require 'cl))
(defun toggle-transparency ()
(interactive)
(if (/=
(cadr (find 'alpha (frame-parameters nil) :key #'car))
100)
(set-frame-parameter nil 'alpha '(100 100))
(set-frame-parameter nil 'alpha '(85 60))))
(global-set-key (kbd "C-c t") 'toggle-transparency)
我想要做的是能够在 Emacs 中选择%透明度。
如果可能的话,我想要一个命令,例如为活动框架键入“Cc t N”(其中 N 是不透明性百分比),然后为非活动窗口键入“Mc t N”。
如果不能那样做,那么可能是一个命令,如果我输入“Cc t”,它会询问我提供活动窗口不透明度的数字(对于使用“Mc t”的非活动窗口也是如此) 。
提前感谢您抽出时间:)
下面只是一些评论,如果您不感兴趣,这些评论对回答问题并不重要:
我真的很想要这个,因为当我告诉我的主管我正在学习 Emacs 时,他说TexShop 好多了,我使用的是 80 年代的软件。我告诉他 Emacs 的神奇之处,他说 TexShop 拥有这一切,甚至更多。除了透明度之外,我匹配了他向我展示的所有内容(尽管他无法匹配来自 Preview-latex 的 Emacs 内的预览)。我偶然发现了透明这个东西,现在我想向他展示Emacs规则!
我想这对你们中的一些人来说是小菜一碟,尽管如果我花足够的时间尝试学习 lisp 或四处阅读,我就可以完成它,但我不是程序员,我只使用过 Emacs 和 mac一周。我已经迷路了!所以提前感谢您的时间和帮助 - 我最终会学习 lisp!
编辑:我的主管使用 TextMate,而不是 TeXShop。现在更有意义了吗?
I want to have a command in Emacs to make it as opaque/transparent as I want (refer to the fabulous question that pointed out that transparency is possible in Emacs, and the EmacsWiki page linked there which has the code I am using below).
The EmacsWiki code sets "C-c t" to toggle the previously set transparency on and off:
;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))
(set-frame-parameter (selected-frame) 'alpha '(85 50))
(add-to-list 'default-frame-alist '(alpha 85 50))
enter code here(eval-when-compile (require 'cl))
(defun toggle-transparency ()
(interactive)
(if (/=
(cadr (find 'alpha (frame-parameters nil) :key #'car))
100)
(set-frame-parameter nil 'alpha '(100 100))
(set-frame-parameter nil 'alpha '(85 60))))
(global-set-key (kbd "C-c t") 'toggle-transparency)
What I would like to do is to be able to choose the % transparency when I am in Emacs.
If possible, I would like a command where I type for example "C-c t N" (where N is the % opaqueness) for the active frame, and then "M-c t N" for the inactive window.
If that can't be done like that, then maybe a command where if I type "C-c t" it asks me for the number which gives the opaqueness of the active window (and the same for the inactive window using "M-c t").
Thanks in advance for your time :)
Below are just some comments that are not important to answer the question if you are not interested:
I really want this because when I told my supervisor I was learning Emacs he said TexShop is much better and that I am using software from the 80's. I told him about the wonders of Emacs and he said TexShop has all of it and more. I matched everything he showed me except for the transparency (though he couldn't match the preview inside Emacs from preview-latex). I found the transparency thing by chance, and now I want to show him Emacs rules!
I imagine this will be a piece of cake for some of you, and even though I could get it done if I spent enough time trying to learn lisp or reading around, I am not a programmer and I have only been using Emacs and a mac for a week. I am lost already as it is! So thanks in advance for your time and help - I will learn lisp eventually!
Edit: My supervisor uses TextMate, not TeXShop. Does it make more sense now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对活动帧使用 Cc t,对非活动帧使用 Cu Cc t。
编辑:
使效果在会话中持续存在的一种方法是启用
desktop-save-mode
并将default-frame-alist
添加到desktop-globals-to-保存
,通过自定义接口:Mx 自定义组 RET 桌面。
Use C-c t for the active frame, and C-u C-c t for the non-active frame.
Edit:
One way to make the effect persists across sessions is to enable
desktop-save-mode
and adddefault-frame-alist
todesktop-globals-to-save
, through the customization interface:M-x customize-group RET desktop.