Emacs是慢,我承认,这也是为什么我在term下使用VIM.
不过今天看到个让Emacs飞起来的办法.真好!!
1.emacs --daemon
我用awesome,所以添加在.xinitrc里面了
eamcs --daemon &
2. emacsclient
emacsclient -c 对应的GUI
emacsclient -t 对应的是term,考虑term下面也换成emacs,那多爽阿.
为了方便 win+enter 直接启动emacsclient -c ,awesome的键绑.
在.bashrc中定义了 alias et='emacsclient -t "$@" -a "vim"'
要是daemon没启动的话就用vim替代.
3.Stopping the Emacs Daemon
The simplest way to stop the emacs daemon from within emacs is to use the kill-emacs or save-buffers-kill-emacs commands.
From outside of emacs this can be achieved using emacsclient:
emacsclient -e '(kill-emacs)'
This will shutdown the daemon immediately with out prompting or saving files.
If you would like emacs to prompt if there are unsaved buffers or existing clients/frames, you can add the following functions to your .emacs file then use the command:
emacsclient -e '(client-save-kill-emacs)'
问题:
1. 关于字体的设置
在client中的是没法用.emacs中定义的字体的,两个解决的方法.
使用利用 emacs 的一个 hook 函数 after-make-frame-functions
;;daemon时的字体
(defun frame-setting ()
(interactive)
;; Setting English Font
(set-face-attribute
'default nil :font "Monaco 12")
;; Chinese Font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
(font-spec :family "文泉驿等宽微米黑" :size 18))))
;; 使用daemon启动的时候,添加字体,启动tabbar和光标闪烁
(if (and (fboundp 'daemonp) (daemonp))
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(frame-setting)
(tabbar-mode t)
(blink-cursor-mode t))))
(frame-setting)
(tabbar-mode t))
设置window-system-default-frame-alist,直接设置参数的默认值
(setq window-system-default-frame-alist
'(
;; if frame created on x display
(x
(menu-bar-lines . 1)
(tool-bar-lines . nil)
;; mouse
(mouse-wheel-mode . 1)
(mouse-wheel-follow-mouse . t)
(mouse-avoidance-mode . 'exile)
;; face
(font . "文泉驿等宽微米黑 8")
)
;; if on term
(nil
(menu-bar-lines . 0) (tool-bar-lines . 0)
;; (background-color . "black")
;; (foreground-color . "white")
)
)
)
我用的是第一个方法,第二个方法没看懂怎么用的.
第一个方法我添加了tabbar和光标闪烁.
2.desktop 的问题
emacs的desktop,公司的电脑有问题,家里的就没有 ,还要在看看.
来源:https://www.cnblogs.com/darwin/archive/2011/05/26/2059282.html