views:

304

answers:

3

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?

+7  A: 

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.

Noufal Ibrahim
+3  A: 

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.

Laurynas Biveinis
+1 for actual code. I have to learn to be less lazy next time. :)
Noufal Ibrahim
A: 

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

Alex Ott