2

I recently explored the Emacs Mac Port developed by Yamamoto Mitsuharu. It feels great and I would like to try using it instead of vanilla GNU Emacs. However, I have some code in my init files which is incompatible with the Mac Port version. I would like to know how to conditionally disable this code.

I'm essentially looking for something like this:

(unless (boundp 'emacs-mac-port-version)
  ;; do this stuff only in vanilla Emacs
)

So how can I detect that I am on the Emacs Mac Port from Elisp?

Drew
  • 75,699
  • 9
  • 109
  • 225
GDP2
  • 1,340
  • 9
  • 25
  • 1
    I think `window-system` will be 'mac instead of 'ns, but I haven't compared to all the different mac versions of emacs yet. – amitp Dec 29 '17 at 01:12
  • @amitp You are correct! That seems to work for my purposes. If you post it as an answer, I will accept it. – GDP2 Dec 29 '17 at 01:32
  • Or `(boundp 'mac-carbon-version-string)`, its `emacs-version` uses this: https://bitbucket.org/mituharu/emacs-mac/src/67b78428be670691c240a20bb7af9248b884d583/lisp/version.el?at=master&fileviewer=file-view-default#version.el-71, it works for both terminal and GUI. – xuchunyang Dec 29 '17 at 05:47
  • @xuchunyang Hmm, interesting. Thanks for the tip. – GDP2 Dec 29 '17 at 06:09

1 Answers1

2

As amitp said in the comments, the window-system variable is 'mac on the Mac Port. Also, as pointed out by xuchunyang, emacs-version yields special output and mac-carbon-version-string is bound.

These things alone should be enough for one to detect whether you're using the Emacs Mac Port, even in a terminal frame.

GDP2
  • 1,340
  • 9
  • 25