[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: One .emacs file for both Emacses



Holger Rauch <Holger.Rauch@heitec.de> writes:
HR> Is it possible to have one ".emacs" file which can handle both GNU
HR> Emacs and XEmacs? If so, what elisp construct do I have to use in
HR> order to distinguish between both Emacs flavors?

One possibility is to look at the emacs-version variable:

(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))

More recently, I've found it more useful to try to look at specific
features and see if they're they're.  For example, my filladapt code
looks like:

(require 'cl)
(ignore-errors
  (require 'filladapt))
(when (fboundp 'turn-on-filladapt-mode)
  (add-hook 'text-mode-hook    'turn-on-filladapt-mode)
  (add-hook 'message-mode-hook 'turn-on-filladapt-mode))

So we try to (require 'filladapt) but don't care whether it succeeds
or not.  Then, if the function turn-on-filladapt-mode is defined, we
add it to {text,message}-mode-hook.

-- 
David Maze             dmaze@mit.edu          http://www.mit.edu/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: