如何启动具有不同配置的emacs [英] How to start up emacs with different configurations

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

问题描述

我经常遇到以下流行的emacs版本:

I often come across the following popular emacs builds:

  • graphene
  • prelude
  • emacs-live

目前我正在运行一个自定义配置,但我想试验这些构建,而不会破坏我当前的〜/ .emacs.d

Currently I'm running a custom configuration, but I'd like to experiment with these builds without clobbering my current ~/.emacs.d.

这里是我当前安装的一些背景:

Here's some background on my current installation:

我通过Homebrew安装了Emacs,所以它位于: /usr/local/Cellar/emacs/HEAD/Emacs.app
我当前的emacs版本是:
GNU Emacs 24.3.50.1(i386 -apple-darwin13.0.0,NS apple-appkit-1265.00)

I installed Emacs via Homebrew, so it's located here: /usr/local/Cellar/emacs/HEAD/Emacs.app My current version of emacs is: GNU Emacs 24.3.50.1 (i386-apple-darwin13.0.0, NS apple-appkit-1265.00)

基本上,这里是我想知道的:

Basically, here's what I'd like to know:


  1. 在这些版本之间以及我目前的自定义配置之间切换的最简单方法是什么?

  1. What's the easiest way to switch between these builds as well as my current custom configuration?

根据我目前的设置,是否可以启动多个emacs会话,每个会话都有各自的配置/缓冲区?

Given my current setup, is it possible to start multiple emacs sessions, each with their respective configuration/buffers?


推荐答案

编辑:我把这个方法包装到一个shell脚本中, =http://www.emacswiki.org/emacs/emacs-distribution =nofollow> EmacsWiki 。)

( I've wrapped this approach up into a shell script which I've added to the EmacsWiki.)

我倾向于使用 $ HOME 环境变量:

I'd be inclined to use the $HOME environment variable:


  1. 首先将分发(为了更好的术语)复制到目录的子目录 .emacs.d 中,该目录将用作替换 $ HOME 。即 / path / to /(distribution)/。emacs.d

  1. Firstly copy the 'distribution' (for want of a better term) into a sub-directory .emacs.d of a directory which will serve as the replacement $HOME for that distribution. i.e. /path/to/(distribution)/.emacs.d:

$ git clone https://github.com/bbatsov/prelude.git ~/emacs/prelude/.emacs.d
$ git clone https://github.com/overtone/emacs-live.git ~/emacs/emacs-live/.emacs.d


  • env 为本命令设置 HOME 环境变量:

  • Then you can start emacs using env to set the HOME environment variable locally for that command:

    $ env HOME=$HOME/emacs/prelude emacs
    $ env HOME=$HOME/emacs/emacs-live emacs
    


  • 他们不应该互相交流,所以你可以一起运行,

    They shouldn't interact with each other, so you can run them together and have multiple side-by-side emacs instances, each using a different configuration.

    我看到 实际上是一个ELPA包,所以它没有 init.el 文件,需要通过软件包管理器安装;但你仍然可以使用相同的技术来安装它在一个单独的干净的配置:简单的类似的目录结构的其他人,然后创建一个init.el文件(例如〜/ emacs / graphene / .emacs .d / init.el ),然后运行emacs(例如 env HOME = $ HOME / emacs / graphene emacs ),然后完成其余的安装说明。

    I see that graphene is actually an ELPA package, so it has no init.el file and needs to be installed via the package manager; but you can still use the same technique to install it in a separate clean configuration: Simply make a similar directory structure to the others, then create an init.el file (e.g. ~/emacs/graphene/.emacs.d/init.el) containing the code from the graphene installation instructions, then run emacs (e.g. env HOME=$HOME/emacs/graphene emacs), and finish the remainder of the installation instructions.

    这种技术的缺点是,Emacs不会看到所有其他点文件看看 $ HOME ),因此从Emacs运行其他进程不一定正常工作;但这不太可能是一个巨大的问题,如果你只是试验,你可以总是符号链接或复制你需要的位。

    The down-side to this technique is that Emacs won't see all your other dot files (because it will be looking in $HOME), and so running other processes from within Emacs won't necessarily work as normal; but that's not likely to be a huge issue if you're just experimenting, and you can always symlink or copy the bits you need.

    你可能更喜欢它 - 好处是,如果在分发的任何东西,你试图将文件写入主目录,它不会破坏你的真实文件。

    You may even prefer it that way -- the benefit is that if anything in the distribution you're trialing writes files to the home directory, it's not going to clobber your real files.

    这也可能一个有用的方法,当Emacs升级到新版本(如果你可以同时运行旧版本和新版本并排),因为你可以设置一个现有配置的副本,以使用新的Emacs,直到你相信一切都是工作,你可以编辑新的配置,而不会有打破你现有的风险。或者反过来,而是将原始配置保存在新的/备用位置,以备需要时作为备份。

    This may also be a useful approach when upgrading Emacs to a new release (if you can run both the old and the new versions side by side) as you could set up a copy of your existing config to use with the new Emacs until you're convinced everything is working, and you can edit the new config without the risk of breaking your existing one. Or flip that around, and instead keep the original config in the new/alternate location, in case you need it as a back-up.

    这篇关于如何启动具有不同配置的emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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