开发者

How can I know if I run emacs or aquamacs at the .emacs file?

I want to make different environment between Cocoa emacs and Aquama开发者_如何学JAVAcs. 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?


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


I believe that what you're looking for is:

(when (featurep 'aquamacs)
   ...)


(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).


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜