tags:

views:

67

answers:

4

I want to make different environment between Cocoa emacs and Aquamacs. They both read ~/.emacs, so I tried something like this.

(unless (symbolp 'aquamacs-version)
; code for emacs
)

But it doesn't seem to work.

How can I know if I run emacs or aquamacs?

+1  A: 

aquamacs will read .emacs, but you can put all your aquamacs specific customizations in aquamacs Preferences.el file:

Install Aquamacs-specific preferences and packages in Aquamacs Emacs paths, others (which should be loaded by other Carbon Emacsen) in Emacs paths. Preferences (.emacs)

These preferences are loaded, in the given order:

~/.emacs (deprecated -- meaning 'should not be used for new installations, but will continue to be supported' -- in Aquamacs on OS X) customizations saved by request or automatically by Aquamacs in customizations.el /Library/Preferences/Emacs/Preferences.el /Library/Preferences/Aquamacs Emacs/Preferences.el ~/Library/Preferences/Emacs/Preferences.el ~/Library/Preferences/Aquamacs Emacs/Preferences.el

Mica
@Mica - I need to use AucTeX for cocoa emacs, and I add -(add-to-list 'load-path "/usr/share/emacs/site-lisp")(load "auctex.el" nil t t) for it. As Aquamacs are pre equipped with AucTeX, I don't want Aquamacs run this code. That's the main reason why I need to check wether I run emacs or aquamacs.
prosseek
why not try carbon emacs? it also has auctex by default, and is pretty much 'vanilla' emacs, plus a few packages. then you can just use (require 'auctex) in your .emacs. I don't think auctex even loads up until you enter latex mode either.
Mica
A: 

I'm not in a position to test this, but if you can't identify Aquamacs by either system-type or window-system, then I imagine you could determine it from the command used to run it. Presuming the executable/link is in fact named "aquamacs", then I would think something like this should do the trick:

(unless (equal (car command-line-args) "aquamacs")
  ...)

Failing that, try M-x apropos-value aquamacs RET to search for any variables containing that string, to use in a similar comparison.

phils
+5  A: 

I'd try (boundp 'aquamacs-version).

offby1
A: 

(symbolp 'aquamacs-version) will always be true. (boundp 'aquamacs-version) will only be true if the symbol has been bound to ("assigned") a value. So your code can, essentially, be replaced by (progn nil), as the condition is always true.

If aquamacs-version is a function, rather than a variable, use (fboundp 'aquamacs-version).

Vatine