如何让 Emacs 启动更快? [英] How can I make Emacs start-up faster?

查看:24
本文介绍了如何让 Emacs 启动更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Emacs v. 22(控制台版本,远程使用 PuTTY 或在本地使用 Konsole) 作为我在 Linux 上的主要文本编辑器.每次我启动它都需要一段时间来加载,可能几乎一秒钟,虽然我从来没有计时.我经常打开和关闭 Emacs,因为我更习惯使用 Bash 用于文件/目录操作和编译的命令行.

I use Emacs v. 22 (the console version, either remotely with PuTTY or locally with Konsole) as my primary text editor on Linux. It takes a while to load up each time I start it though, probably almost a second, although I never timed it. I tend to open and close Emacs a lot, because I'm more comfortable using the Bash command-line for file/directory manipulation and compiling.

如何加快启动时间?

推荐答案

除了 Adam Rosenfield 的解决方案,我推荐使用 服务器模式下的 Emacs.您可以将 (server-start) 添加到您的 dotemacs,并在您想在 Emacs 中打开文件时运行 emacsclient 而不是 emacs.这样你只需支付一次 Emacs 的加载成本,然后客户端就会立即弹出.

In addition to Adam Rosenfield's solution, I recommend to use Emacs in server mode. You may add (server-start) to your dotemacs, and run emacsclient instead of emacs whenever you want to open file in Emacs. That way you have to pay the loading cost of Emacs only once, after then clients pop up immediately.

编辑

您说得对,v22 不会创建新框架.创建一个执行此操作的 shell 脚本:

You're right, v22 does not create a new frame. Create a shell script that do the trick:

#!/bin/bash
# Argument: filename to open in new Emacs frame
/usr/bin/emacsclient -e '(let ((default-directory "`pwd`/")) (select-frame (make-frame)) (find-file "'$1'"))'

编辑 2

在 v24+ 中,您可以执行 emacsclient -c 来创建一个新框架.

In v24+, you can do emacsclient -c to create a new frame.

这篇关于如何让 Emacs 启动更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆