0

On my Macbook, I get different syntax highlighting for Python depending on how I launch Emacs.

  • If I launch via the MacOS app (installed via Homebrew) I get full syntax highlighting (first screenshot)
  • If I launch via the terminal with emacs or SSH into my Macbook and run emacs, I get limited syntax highlighting (second screenshot)

This is not desirable behavior because it means I get limited syntax highlighting when I SSH into my Macbook (via Blink for iPad).

I can confirm all colors are available because JS files look as expected and this is not an issue with 256 color vs. 24bit color.

I’m using the Dracula color theme, but I get the same issue with other color schemes.

I don’t know what else to try. Any ideas?

Here is that I expect to see (Emacs MacOS app via Homebrew): Python syntax highlighting on RPi 4

Here is what I actually see (emacs via Terminal or SSH): Python syntax highlighting on MacBook / MacOS

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 2
    I think the first thing I'd look at is the `TERM` environment variable to see if it's the same across the sessions you're testing. The second thing is that each machine has its own database of capabilities for each TERM terminal name, and it's possible your machines have different databases. [This post has more info](https://emacs.stackexchange.com/questions/26708/term-terminfo-termcap-what-are-they-how-does-emacs-use-it) but I don't have a solution. – amitp Jan 27 '22 at 17:58
  • 1
    It's not clear to me what you are doing, e.g. where is Emacs running? Where is Emacs displaying? Are you running a GUI Emacs or a terminal Emacs? Please edit your question with a step-by-step recipe, describing the initial setup and everything you do to come up with what you show in the screenshots. – NickD Jan 27 '22 at 18:54
  • those details were included but I've edited for clarity. thanks for any help you might have. – charliesneath Jan 27 '22 at 19:33
  • Is there a reason you're not running a gui emacs on your iPad and shh into your MacBook via emacs on your iPad? – henning Jan 28 '22 at 17:25
  • as @amitp suggested, check your TERM setting. in `Terminal.app` with `TERM=xterm-256color` the Dracula theme should be almost identical between GUI and terminal. With `TERM=xterm` syntax highlighting with Dracula is sparse and plain. Check both Settings->Profiles->"your profile"->Advanced->Terminfo and your shell init files to make sure you're not resetting TERM. – nega Jan 28 '22 at 18:49
  • What versions of Emacs are you running? MacOS comes with Emacs 22, it might be the one you get when you simply run `emacs`. – Lindydancer Jan 28 '22 at 20:53
  • I can confirm that Terminal.app is using `xterm-256color` and this is what I get via `echo $TERM`. This is also emacs 27.2 via Terminal. – charliesneath Jan 28 '22 at 21:59
  • silly question, but are you starting your terminal emacs from the terminal? ie not via Finder or a shortcut? – nega Feb 02 '22 at 03:47
  • With a minimal `init.el` you should see something like https://gist.github.com/nega0/f11301a899b0eff68e33f91d1924859a Each terminal emacs was started with `/Applications/Emacs.app/Contents/MacOS/Emacs -nw /tmp/99beers.py`, and the gui emacs with `open -a Emacs /tmp/99beers.py` – nega Feb 02 '22 at 03:48
  • @Lindydancer fyi Apple removed Emacs in Catalina. macOS does have `mg` though :\ – nega Feb 02 '22 at 04:05
  • `mg` -- I haven't seen that in a while. That was my way into Emacs, back in the eighties on the Amiga... – Lindydancer Feb 02 '22 at 09:18

1 Answers1

1

I've had the same challenge over months and tonight I decided to invest more time into solving it and finally succeeded. The issue was my .zshrc file had

  • alias emacs='mg'

According to this article https://www.emacswiki.org/emacs/Mg, mg "is a lightweight public-domain ErsatzEmacs, dating back to 1986." My interpretation of this (I could be wrong) is that it is not as sophisticated to have the expected color highlights. As soon as I commented the alias out, the colors were restored.

Hope that helps!

kunwiji
  • 11
  • 2
  • 2
    Wow. It’s been a long time since one of those has cropped up. For the benefit of future visitors, this is an editor that copies some aspects of Emacs’s UI and default keybindings, but which isn’t extensible and thus does not include 99% of the features of the real Emacs. – db48x Jul 10 '22 at 06:10
  • Glad I'm not the only one with a similar issue! My .zshrc doesn't have any aliases for emacs, unfortunately. I've checked my other profiles and don't see anything else there. Was that alias for mg set automatically on your machine? – charliesneath Jul 11 '22 at 15:20