When Mac OS X Emacs Displays Unicode Symbols Too Wide

Was I going crazy, or was Emacs displaying certain text too wide?

Symptoms

Most the problems I observed was when using emacs ansi-term, but they can happen anywhere the Emacs Mac OS X application is displaying Unicode characters.

Oddly wide  dashes (em dashes is the publishing terminology).

Emacs Window Showing Wide Dash

Too Wide Em-Dash Amongst Monospaced Text

Lines wrapping, output Unexpectedly Wrapping Beyond the Bottom of the Emacs Windows, and Black Boxes

Screen shot of Emacs Lines Wrapping When They Shouldn't

Lines Wrapping When They Shouldn’t

Root Cause

It took me a long time to figure out:

  1. That I wasn’t going crazy.
  2. The root cause.

To make a long story short, I had stumbled across Emacs Bug 11450 – Fallback Font Used Even When Available in Primary Font which can be translated as: “fancy characters don’t display correctly using the Mac OS X Emacs application.”

Solution

The solution boils down to adding this snippet to your emacs init file (aka .emacs file):


(when (eq window-system 'ns)
(set-default-font "Monaco")
(set-fontset-font "fontset-default" 'symbol "Monaco")))

Note: You may want to choose a different default font other than Monaco.

One thought on “When Mac OS X Emacs Displays Unicode Symbols Too Wide

  1. Hi,Your post got me on the right track, but it turned out that for me, the crreoct variable is:default-major-modeNow to find how to set default minor modes…Best,Chris

Leave a Reply

Your email address will not be published. Required fields are marked *