如何为windows和linux电脑搭建通用的emacs环境?

发布于 2024-08-17 09:52:09 字数 496 浏览 6 评论 0原文

我使用 emacs 进行文本编辑和脚本开发。我使用 Windows 和 ubuntu emacs 23.1 发行版。

现在我希望我的 Linux 和 Windows 环境复制相同的环境。

  1. 我将在这里保存我的 emacs 环境 https://bitbucket.org/krish/emacs/ ,所以文件同步不会有问题。

  2. 我的环境没有任何不同的分辨率设置

  3. 我使用aspell,它需要特定的路径和Windows和Linux中的不同安装程序

  4. 我使用 perl、python、ruby 模式以及其他 html、css、js-2 和 nxml

是否有任何特定的方法/建议来管理 Windows 和 Linux 之间的通用 emacs 环境?特别是如何管理程序路径?

I use emacs for text editing and script development. I use both windows and ubuntu emacs 23.1 distribution.

Now I want both my linux and windows environment to replicate the same environment.

  1. I will save my emacs environment here https://bitbucket.org/krish/emacs/, so file synchronisation will not be problem.

  2. I don't have any different resolution settings for both the envionment

  3. I use aspell which need specific path and different installer in windows and linux

  4. I use perl, python, ruby mode along with other html, css, js-2 and nxml

Are there any specific way/advise to manage the common emacs environment between windows and linux? especially how to manage the program path?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

书间行客 2024-08-24 09:52:09

没有真正直接的方法。您必须将大多数(如果不是全部)平台特定例程隔离到不同的文件中,并在检查平台后加载它们。

Steve Yegge 通过 这里。他的观点之一是他如何保持跨平台的可破解性。值得一读。

There's no real straightforward way. You'd have to isolate most (if not all) your platform specific routines into different files and load them up after checking for platform.

Steve Yegge has some information on how he manages his .emacs file along with the actual code itself over here. One of his points is how he keeps is cross platform hackable. It's worth a read.

你穿错了嫁妆 2024-08-24 09:52:09

我的设置与你的非常相似(Emacs 22.1、22.2、23.1,在带或不带 X 的各种 Linux 版本上,带或不带 Cygwin 的 Windows 上)。我的设置包括 ELPA、auctex、emacsw32、CEDET、JDEE、nxml 和各种其他 elisp 软件包。我不使用系统附带的任何东西,而是在 subversion 中保留这些软件包的副本。

大多数设置适用于所有环境。关于路径,我认为大多数想要调用的东西,比如 aspell,也可以在 Emacs 之外从命令行调用,所以值得将它们放在 $PATH 中,从而避免在 Emacs 中指定完整路径。

对于其他事情,我做
在 .emacs 中:

; Load system-specific library and setup system-specific things that 
; must be setup before main setup 
(cond ((eq system-type 'windows-nt) (load-library "ntemacs-cygwin"))
      ((eq system-type 'gnu/linux) (load-library "linux"))
      (t (load-library "default")))

(system-specific-setup)

; Set up things as usually, no more system-type queries.

在 linux.el 中:

(defun system-specific-setup()

  ; Default font
  (add-to-list
   'default-frame-alist
   '(font . "-Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-ISO8859-1"))
  (setq my-frame-width 95)
  (setq my-frame-height 56)
  ; Not much else
)

在 ntemacs-cygwin.el 中:

(defun system-specific-setup()
  ;; EmacsW32
  (setq emacsw32-root (concat private-elisp-lib "EmacsW32"))
  (add-to-load-path emacsw32-root)

  ;; Work around XSymbol initialization bug
  ;; ("C:\\ImageMagick\\convert" instead of system $PATH? Seriously?)
  (setq x-symbol-image-convert-program "convert")

  ;; etcetera...

)

基本上,这是一个在一个系统上进行设置,在另一个系统上尝试它们并找出与系统特定设置不同的任何内容的问题。

Noufal 的回答中 Steve Yegge 的文章是一篇非常好的文章。

I have a very similar setup to yours (Emacs 22.1, 22.2, 23.1 on various Linux versions with and without X and Windows with and without Cygwin). My setup includes ELPA, auctex, emacsw32, CEDET, JDEE, nxml and various other elisp packages. I do not use whatever comes with the system but keep copies of those packages in subversion.

Majority of setup just works in all environments. Regarding paths, I think that majority of stuff one wants to call, such as aspell, can be called outside Emacs from command line too, so it`s worth putting them in $PATH thus avoiding having to specify full paths in Emacs.

For other things, I do
In .emacs:

; Load system-specific library and setup system-specific things that 
; must be setup before main setup 
(cond ((eq system-type 'windows-nt) (load-library "ntemacs-cygwin"))
      ((eq system-type 'gnu/linux) (load-library "linux"))
      (t (load-library "default")))

(system-specific-setup)

; Set up things as usually, no more system-type queries.

Where in linux.el:

(defun system-specific-setup()

  ; Default font
  (add-to-list
   'default-frame-alist
   '(font . "-Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-ISO8859-1"))
  (setq my-frame-width 95)
  (setq my-frame-height 56)
  ; Not much else
)

And in ntemacs-cygwin.el:

(defun system-specific-setup()
  ;; EmacsW32
  (setq emacsw32-root (concat private-elisp-lib "EmacsW32"))
  (add-to-load-path emacsw32-root)

  ;; Work around XSymbol initialization bug
  ;; ("C:\\ImageMagick\\convert" instead of system $PATH? Seriously?)
  (setq x-symbol-image-convert-program "convert")

  ;; etcetera...

)

Basically it is a matter of setting things up on one system, trying them on another and factoring out whatever needs to be different to the system-specific-setup.

And the Steve Yegge´s article in Noufal´s answer is a very good one.

客…行舟 2024-08-24 09:52:09

您可以查看我的emacs配置,其中不同网络机器的操作被分成单独的文件

You can look to my emacs configs, where operations for differnet machines are splitted into separate files

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文