如何在.emacs中创建一个特定的窗口设置 [英] how to create a specific window setup on in .emacs
问题描述
但是在启动时,我想配置一个特定的安排的窗口/框架。基本上,我每次启动emacs时都要执行以下操作(通常每天最多一次,然后几天/周)。
1。将屏幕分成两半(Cx 2)
2.将上半部分增加20行(Cu 20 Cx ^)
3.打开第二帧emacs(Cx 5 2)
理想情况下,我甚至希望最大化我的左侧显示器上的第一帧,右侧显示器上的第二帧,但是我可以没有这个。
我只是想知道你如何将关键命令的功能写入.emacs文件。
Emacs中的最佳功能是自助文档帮助,所以您可以轻松地
找出如何编写所需的Emacs-lisp中的命令与
其他语言的经验。
但是,由于你想要的是一个简单的键盘,宏
将为您服务,并为您提供开始写作的好地方。
这是我输入的一个关键顺序:
Cx(Cx 2 Cu 2 0 Cx ^ Cx 5 2< switch-frame> Cx)
我已经记录了一个宏来做你所问的事情。然后 Mx edit-last-kbd-macro ,我看到:
;;键盘宏编辑器。按C-c C-c完成;按C-x k RET取消。
;;原始键:Cx 2 Cu 20 Cx ^ Cx 5 2
命令:last-kbd-macro
键:无
宏:
Cx 2 ;; split-window-below
C-u 20 C-x ^ ;;放大窗口
C-x 5 2 ;; make-frame-command
然后 Mx name-last- kbd-macro foo Mx insert-kbd-macro foo
(fset'foo
[?\Cx?2?\Cu?2?0?\Cx?^?\Cx?5?2(开关框# ;框架* Minibuf-1 * 0x101855410>)])
将最后一个块添加到.emacs文件,并用
(foo)
I am very new with emacs and Lisp, though from experience with other functional languages it's not too hard for me to mimic what I am seeing in useful code snippets. I've added some nice window toggling features in the .emacs file and they are working well.
But on start-up, I'd like to configure a specific arrangement of windows/frames. Basically, I want to do the following each time I launch emacs (which is generally at most once per day and then it is left open for days/weeks).
1. Split the screen in half (C-x 2)
2. Grow the top half bigger by 20 lines (C-u 20 C-x ^)
3. Open a second frame of emacs (C-x 5 2)
Ideally, I'd even like to maximize the first frame on my left monitor and the second frame on my right monitor, but I can do without that.
I am just wondering how you write the function equivalent of the key commands into the .emacs file.
The best feature in Emacs is the self documenting help, so you can easily figure out how to write the desired command in Emacs-lisp with experience in other languages.
But because what you want is a straight forward sqeuence of keys, a macro would serve you best, and it gives you a good place to start writing
Here is a keysequence I entered:
C-x ( C-x 2 C-u 2 0 C-x ^ C-x 5 2 <switch-frame> C-x )
I've recorded a macro to do what you asked. Then M-x edit-last-kbd-macro, I see:
;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel.
;; Original keys: C-x 2 C-u 20 C-x ^ C-x 5 2
Command: last-kbd-macro
Key: none
Macro:
C-x 2 ;; split-window-below
C-u 20 C-x ^ ;; enlarge-window
C-x 5 2 ;; make-frame-command
Then M-x name-last-kbd-macro "foo" M-x insert-kbd-macro "foo"
(fset 'foo
[?\C-x ?2 ?\C-u ?2 ?0 ?\C-x ?^ ?\C-x ?5 ?2 (switch-frame #<frame *Minibuf-1* 0x101855410>)])
Add the last chunk to your .emacs file, and call it with
(foo)
这篇关于如何在.emacs中创建一个特定的窗口设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!