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?

  • 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 1: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 1:32
  • Or (boundp 'mac-carbon-version-string), its emacs-version uses this: bitbucket.org/mituharu/emacs-mac/src/…, it works for both terminal and GUI. – xuchunyang Dec 29 '17 at 5:47
  • @xuchunyang Hmm, interesting. Thanks for the tip. – GDP2 Dec 29 '17 at 6:09
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.