2

I put each type emacs settings into some single files, like load-cygwin.el, load-cedet.el etc. And use a subverion to share them everywhere and everytime.

Now for load-cygwin.el, it's only need on Windows platform, but every-time I sync these configurations in Linux platform, I have to remove them.

How could the emacs not load the load-cygwin.el file while initializing? I need some conditions to jump out the file?

thanks.

James.Y
  • 1,427
  • 1
  • 11
  • 16

3 Answers3

2

There are different ways to deal with it. One way (which I use)

I assagin a name for each system based on the hostname. (you can also define checking window system/emacs vesrion/OS and so on..)

 ;;;;;;;;;;;;;;  define systems ;;;;;;;;;;;;;;;;

 (defvar on-laptop          ; on my laptop, mostly I can run everything
   (string-match "rag" (system-name)))

 (defvar on-lab-computer                 ; main lab desktop
   (string-match "okho" (system-name)))

 (defvar on-lab-server        ; lab cluster
   (string-match "amu" (system-name)))


 ;;;;;;;;;;;;;;; Usage ;;;;;;;;;;;;;;;;;;;;;;;;;
 (when on-laptop
 ;;; music / emms config
   (load "emms-config.el"))


 ; load work related stuff
 (when on-lab-computer
   ;; load work related

    )


 (when (not on-lab-server)
   ;;; some setup that are unnecessary on cluster, but useful on remaining systems

   )
kindahero
  • 5,817
  • 3
  • 25
  • 32
0

For OS-dependent settings, check the system-type variable:

(and (memq system-type '(cygwin windows-nt))
     (load "load-cygwin"))

Another way to handle conditional requirements is to use the locate-library function to see if the file exists. (This assumes that load-cygwin.el is not present on your Linux machines.)

(and (locate-library "load-cygwin")
     (load "load-cygwin"))

Another useful variable for this sort of conditional requirement is window-system.

cjm
  • 61,471
  • 9
  • 126
  • 175