When Mac OS X Emacs Displays Unicode Symbols Too Wide

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


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.”


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.

How to Make Thunderbird Chat Work with Most XMPP/Jabber Accounts

I really like how Thunderbird 15.0 has build in support for populate chat services like Google Talk, Twitter, and XMPP (aka Jabber).

What I don’t like is that Thunderbird’s support for these is minimal, and when things don’t work it is almost impossible to figure out why.

Here are two issues I ran into and their solution.

Jabber/XMPP Accounts seems stuck on “Connecting”

Before you assume that you ran to the issues I did, try port 5223 rather than port 5222. Port 5223 is the old school “secure” port for XMPP/Jabber. The more modern way is that port 5222 is used, but the server then negotiates a secure connection.

For me the root cause turned out to be a special feature in how XMPP looks up servers. If a company doesn’t want to open a port on their main server (for example bigcompany.com) they can add a special internet name lookup (DNS Record) saying “my jabber server is really over on the other server). These kind of records are called DNS SRV records.

Most XMPP clients do this for you automatically, but Thunderbird 15.0 doesn’t do this, fortunately, you can do the same look up yourself and then tell Thunderbird to user the other server instead.

How to Lookup the Actual XMPP Server for an Account

Instead of running command line tools, some helpful souls haven put together online tools to find your XMPP server, so that’s what we’ll us:

  1. Open your web browser to https://kingant.net/check_xmpp_dns/.
  2. In the text field under Check DNS SRV records for XMPP, enter the part of your XMPP/Jabber account that happens after the @.
  3. Click on the Check button.

  4. If the results say “ERROR”, then the problem you are having is not due to the SRV record feature, but something else.
  5. In the Client records for section of the results, locate the Target column, and copy the value immediately under it.
  6. Go back to Thunderbird, choose Tools->Account Settings…”, click on your XMPP account in the left hand ride, and then paste into the Server field.
  7. Click on OK to close the preferences window.

How to Fix when You Connect and then are Immediately Disconnected from the XMPP Server

Once I had done the previous steps to fix server lookup, I immediately found that my account was immediately disconnected.

After verifying the username and password, I did some investigation and determined that my XMPP/Jabber server has an “invalid” SSL certificate. You may be wondering how a server might have an invalid certificate? The answer is that valid certificates cost money and require a unique internet address for the server. If you are using a free service from a small company, or even an internal server, odds are good that they won’t be springing for an officially signed SSL certificate any time soon.

All is not lost though, you can tell Thunderbird that you trust the server, and that Thunderbird should also.

Here’s how:

  1. In Thunderbird open the Preferences windows.
  2. Click on the Advanced tab.
  3. Click on the Certificates section.
  4. Click on View Certificates.
  5. Click on the Servers tab.
  6. Click on Add Exception….
  7. In the Location: field, delete https:// and enter the server name you looked up the SRV section above. If you got an ERROR when looking up the SRV record, enter the part of your XMPP/Jabber account that happens after the @.
  8. After the server name enter :5222. Be sure and include the colon (:).
  9. Click on Get Certificate
  10. Make sure Permanently Store this Exception is checked.
  11. Click on Confirm this Exception.
  12. Click on OK.

Good Luck

With any luck you will now be able able to connect to your Jabber/XMPP server.

Please suggest improvements to these directions in the comments.

How to fix MacPort’s version of w3m from crashing on Mac OS X 10.7 Lion

I like to use w3m command to display HTML content in emails under emacs.

I recently noticed some w3m instability after I upgraded to Mac OS X 10.7 Lion:

$ w3m http://www.nytimes.com/
Segmentation fault: 11

Mac OS X also offered a helpful message of w3m quit unexpectedly and offered up a Problem Report that looked like this:

Process:         w3m [835]
Path:            /opt/local/bin/w3m
Identifier:      w3m
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  bash [3425]

Date/Time:       2012-06-23 22:07:41.760 -0500
OS Version:      Mac OS X 10.7.4 (11E53)
Report Version:  9
Sleep/Wake UUID: 622A3F05-8259-4DF2-82F6-3CACB28E7F3D

Interval Since Last Report:          210793 sec
Crashes Since Last Report:           2
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      FCCF1BD2-936E-4A92-A3C1-D6C071E5132D

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008

VM Regions Near 0x8:
    __TEXT                 0000000109832000-00000001098b7000 [  532K] r-x/rwx SM=COW  /opt/local/bin/w3m

Application Specific Information:
objc[835]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   w3m                           	0x000000010989027b pushValue + 75
1   w3m                           	0x000000010984ad7b flushline + 2523
2   w3m                           	0x000000010984f40b HTMLtagproc1 + 2875
3   w3m                           	0x0000000109852b54 HTMLlineproc0 + 1876
4   w3m                           	0x00000001098564b2 loadHTMLstream + 1954
5   w3m                           	0x00000001098495f6 loadHTMLBuffer + 182
6   w3m                           	0x000000010984444a loadSomething + 26
7   w3m                           	0x0000000109847f48 loadGeneralFile + 6296
8   w3m                           	0x00000001098342e6 main + 4838
9   w3m                           	0x0000000109832ed4 start + 52

The above is pretty annoying, and after many Web Searches I found MacPort Ticket 30710.

Which explains that the current MacPorts version of boehmgc package isn’t Lion compatible.

Fortunately, the solution explained in the MacPorts ticket is simple, instead of the boehmgc package, use the newer boehmgc-devel package instead.

To make the switch I ran the following commands:

$ sudo port deactivate w3m boehmgc
--->  No broken files found.

$ sudo port install boehmgc-devel w3m 
--->  No broken files found.

And now w3m works well under Mac OS X 10.7 Lion.

How to Make Emacs SSL Work on Mac OS X

If you find yourself on Mac OS X having problems getting SSL working for Emacs under Mac OS X, you might try installing GnuTLS and telling emacs to use that instead.

Why would you need this? In my case I was just trying to get Wanderlust (the best email client for emacs in my opinion) to connect to server that only support an SSL connection.

To Install GnuTLS

In general I recommend the MacPorts package as way to install GnuTLS (and many other useful packages).

Once you have MacPorts installed, you can then install GnuTLS with this command:

sudo port install gnutls

Tell Emacs to use GnuTLS

After that it is simply a matter of telling emacs you want to use GnuTLS by adding something like this to your .emacs:

(setq ssl-program-name "gnutls-cli"
      ssl-program-arguments '("--insecure" "-p" service host)
      ssl-certificate-verification-policy 1)

Odds are excellent it will work with the above setting, but that carries a security risk that someone might be “spoofing” the far end of the connection, but you wouldn’t know about it. For security reasons, you should therefore removed the "--insecure" part, but if you are dealing with self signed certificates that is certainly the lazy way out.

Workaround for dansguardian and iTunes 9.1

The recent iTunes 9.1 update from Apple came with a bug that breaks compatibility with the Dansguardian web content filter and results in an Can’t Connect to the iTunes Store error message from iTunes.

What is happening is that iTunes requests a URL with a dot after the hostname:


And dansguardian rejects it as a malformed URL (since it is).

You can test it by typing:


into a browser (note the period/dot after com).

If you get a Dansguardian Malformed URL page and running iTunes 9.1, it is very likely your problem.

In any event, here is a quick and dirty source code workaround to sidestep the issue: iTunes.patch.

Note that this workaround only helps a system administrator/IT type who can rebuild dansguardian from source and install it into your production environment.

I tried to take an approach where Dansguardian would see the URL internally as the non-dotted version so that URL regex’s would not be thrown off, but it is possible that my patch breaks some host or URL matching/filtering within Dansguardian (content filtering should be unaffected).

WARNING: Use the above patch at your own risk.

Google Reader’s dirty little secret? You can’t tell when your subscriptions are broken.

Google reader is probably the best all around feed reader there is. Its easy-to-use interface works from just about any device and it makes keeping tracks of many websites a “one stop shopping” experience.

Imagine my surprise when I decided to try out an competing feed reader only to discover a number of my subscriptions had been broken for a long time, and Google Reader never bothered to alert me.

This is a huge issue; Google Reader’s only job is to reliably deliver updates from the websites you choose, and it doesn’t tell you when it fails? The equivalent would be sending emails and not getting “bounce” messages back if the message couldn’t be delivered.

Why were my subscriptions broken? After I subscribed, some of the websites had upgrades that changed the address of the subscription. Then when Google Reader tried to retrieve updates the requests failed and Google Reader was silent. I never knew my subscriptions weren’t being delivered.

This reminds me of the whole Seinfeld “What is a reservation?” routine:

The workaround is to use the Google Reader Trends functionality and and look under the Inactive Tab under Subscription Trends heading. If you have a subscription that hasn’t been updated in more than a few days it probably broken.

You have been warned.

Breaking up with Singleton

Have you ever secretly come to really dislike someone?


At first you think they’re great. You might even want to get closer. Then, after spending time with them, you realize they are a little obnoxious. Then, bit by bit, you start avoiding them whenever you can.

Finally, the day comes, when a friend quietly whispers “You know, I can’t stand that person”.

Reaction: Relief

Suddenly you realize you’re not crazy, it isn’t you. It’s them. Really.

Well that day has come for me and the Singleton design pattern. In Steve Yegge’s Singleton Considered Stupid I found a friend to confirm my now near hatred for the so called singleton design pattern.

Singleton and I used to be close. When I first started seeing, and, I’ll admit it, using singleton I quickly began feeling a growing unease. I found myself callously using singleton to allocate an instance, and then never speaking to singleton or the instance again.

Then things went from bad to worse. Once I started testing singleton I noticed how self centered singleton was. How could someone insist that they always be “the only one”?

Finally I started cheating; using backhanded methods to use and discard whole series of singletons. I even always took care to keep each one ignorant of the other. I told myself it was just for “unit testing”, but I knew better.

Now I realize I can’t live like this. It’s over.

Now I will only be design patterns who don’t have to be the center of universe. No more cheating, no more lying.

I hope I never see another singleton again.

A Gentle Introduction to using RSS

I know many people who have never tried RSS, so here is my attempt at a gentle introduction…

The problem: Too Many Places

Too many website to keep an eye on.

If you are like most people, the internet is both a blessing and a curse. A blessing because of the wealth of data available, a curse because it is easy to waste valuable time and get nothing in return.

For example, if you have a single website you love, maybe you check it several times a day. Easily done.

Sometimes you check a website and there is a new article worth reading, but sometimes there is nothing new. A few minutes wasted.

But what if you have three site you love…then it starts to get tedious, you go to one site for the weather, a second for news, a third for your hobby, a fourth for your grandchildren’s school.

The solution: Just one place

What if, instead, you could check one place and see updates appear from any of the sites you are interested in? Then instead of checking three places, or five, or ten, you could check only one but still get the information you want.

This concept is called “RSS aggregation” (RSS is a a kind of a file format — you probably already know what aggregation is).

But no matter what you call it: RSS is a way to know when new articles appear.

Nothing special about it really.

RSS contains the following information:

  • Links to the most recent articles on the site
  • Titles, descriptions, and other details of the articles and the website

How it works

The good news is that you never have to edit or save an RSS file, that is the job of the website, they keep their RSS file updated with the list of the latest articles. All you have to do is tell your RSS client software (more on that later) to do the website checking for you. You do this telling your RSS software the web address (URL) to the RSS file on the website you want to keep tabs on.

The RSS software then checks the website at regular intervals (usually every hour) so you don’t have to.

How to spot an RSS link

What RSS practical, is that most sites now supply RSS. This trick is knowing that is is there.

RSS files come in several “flavors” among them various versions of RSS and Atom. The term XML is also sometimes used to indicate an RSS or Atom feed (technically speaking XML is a much more generic term that also includes a huge number of other things).

So to make a long story short, look for links or icons on web pages labeled like the following:

  • Atom

RSS Client Software

There are many many choices and this article will not cover any specific choice.

Regardless of the RSS software you choose, they all do the same thing: give you the ability to get your updates at one place instead of many.

There are two broad categories: websites and applications.

RSS Client Website

This type of website collects feeds and displays them. The checking happens from the remote website, and the remote website keeps up to date even if you computer is off or disconnected from the internet.


  • Accessible from any computer on the internet.
  • No installation needed.


  • If you have intranet (not accessible from the internet) RSS feeds, this software will not be able to access it.
  • You must be connected to the internet to even read the headlines.

RSS Client Application

This is software you download, install, and run on your computer like any other application.

RSS Clients that run on your computer

This software runs on your computer and is usually installed as a stand alone application or may even be available as part of your web browser.


  • Can read headlines and sometimes even the articles themselves while disconnected from the internet.
  • Can access intranet RSS feeds.


  • Runs only on the computer(s) you installed on.

Getting Started

The best way to start is to try one of the many RSS Clients. A list is available at blogspace.

If the above list seems overwhelming, the Google Reader as a good place to starting getting familiar with an RSS Client.

For your first feed, try mine at https://rmore.net/planet/rmore/rss10.xml.

Whatsa matter buddy? Yous gotta problem with Javascript?

After more than 10 years as a professional software developer I have decided that you can write good code in any language…or bad code.

I’ve seen great assembly language, bad Java, scintillating Visual Basic, poor Python, ludicrous lisp, crisp Hypertalk, and even some very good Javascript.

David Chelimsky asks What’s the Problem with Javascript and all I can do is nod my head and state “I concur”.

Javascript allows you to create classes, subclasses, and even has studly regular expression support that would make a Perl user feel right at home.

Many languages suffer from what can only be considered “the AOL” effect. When AOL really took off, (slightly) longer time internet users considered AOL users to be worthless. Some of it was that they didn’t understand [http://www.dtcc.edu/cs/rfc1855.html netiquette], but it was also that their entry onto the internet was considered too easy. They weren’t smart enough, or technical enough, or elite enough to count like ”’real”’ internet users.

Programming languages are the same way. Lisp and C++ users regularly look down on programmers using almost any other programming language because the barrier of entry to Lisp and C++ is high. Mastering difficult languages, and anything else with a high barrier of entry, should result in feelings of pride, but they also often result in feeling of superiority over others.

When I started doing web development, I felt the same way about Javascript. I had mastered C++, Lisp, and many other languages. Perhaps I would do a little client side validation in Javascript, but certainly nothing more.

It turns out Javascript is a pretty nice language. It has a fairly modern runtime: easy, built-in arrays and mapping types, garbage collection, a well designed library, and the ability to manipulate almost anything in a client browser. With a little more study I discovered that the prototype based object system was very handy for developing classes and subclasses and the syntax for doing so was only slightly more awkward than Smalltalk, Java, or C#.

These days I am asked to, and am willing, to write code in many languages I once thought beneath me.

Today if someone were to say about me “Writes good code regardless of language.” I would proud.

Any developer worth hiring should be.

Work Recognition

Right before I left my old job, I got an award for being an “outstanding contributor” in our engineering group. To be honest it felt good to be given an award, and even better it comes with an iPod, an iTunes gift certificate, and a plaque.

You can tell a non-technical person wrote the award letter though, because it didn’t say what kind of an iPod it was. That is like telling a wine enthusiast they will be getting a bottle of “red wine”.

In any event, I was very surprised, and pleased, and yet it immediately brought to mind the times in the past I had not won similar awards. Not that I expected to, but I can always dream can’t I? Part of the reason I left soon after was that they were putting in a new “incentive” system which requires that the vast majority of workers will be told they are average and be awarded accordingly — how is this an incentive system?

As usual [http://www.joelonsoftware.com/articles/fog0000000070.html Joel on Software has a bead on this issue].

Somehow I think that management is caught up in the idea that managing software developers is just like managing a sports team; that the pursuit of excellence is all about “winning the big one”. Maybe there is something about winning it all, but that isn’t how players or teams become great.

Players and teams become great because they love playing the game. They love the feeling of a performing well, or making a great play, or maybe even just tackling someone.

You can read what makes players tick in the old [http://www.findarticles.com/p/articles/mi_m1208/is_35_225/ai_77811426 Sporting News article] from 2001.

To me hockey players are the ultimate love of the game group:

“Growing up we always played baseball, football and basketball. One day, the guys said we should try hockey. Wow! What a blast! You had the hand-to-eye coordination of baseball, the hitting of football and the stops-and-starts stamina of basketball. I thought to myself, `Why should I fool around with the other sports when hockey gives me all of the best of the other sports?'”

–Islanders goalle Rick DIPietro

Every year the [http://live82.ihwc.net/english/ IIHF World Championship] is held. Think of it as a mini-Olympics for hockey. The best hockey players play in the IIHF World Championship every year, even during an era when the US Olympic baskball team can’t even attract players who actually are interested in playing.

Even though I stumble around on my recreational league hockey team, I still love it.

And any decent software developer is the same way. They love writing software. Sure, they work at your company because they need the money, but they write great software because they love doing it. Period.

So as far as I am concerned all these corporate incentive plans, plaques, and awards for working weekends and cranking out ugly code can go into the trash can, the recycle bin, or /dev/null.

But I’m not giving back the iPod.

The Truly Ecumenical Pope

As usual Orson Scott Card says something better than I could ever hope in his World Watch column Why I Miss Karol Wojtyla:

John Paul II, more than any other Pope, united, in feeling if not in fact, Christians who take the divine Redeemer seriously. That’s the “ecumenical movement” that means something, in my opinion.

Even though I am not a Mormon or a Catholic, I feel the greatest kindred spirit with those Christians whose faith demands (quoting Orson Scott Card’s column again)

…some real and rational degree of sacrifice, obedience, and adherence to faith…

so to Karol Wojtyla and Orson Scott Card I can only follow with an simple Amen.

Self critique and the surgeon

How the best surgeons realize they make mistakes and try to figure out how to improve is the subject ofa recent article by the always engaging Dave Thomas of Pragmatic Programmers fame.

As a software developer I find that on every project I look back and I am disappointed by some design decision or implementation choice that didn’t turn out as cleanly as I had hoped.

In my current role as a software architect (a title and position I ironically am not a fan of) I worry that it is easy to unravel the feedback loop as more time is spent in meetings, design sessions, and writing emails. Once you start down the path of less hands-on work how do you truly understand the consequences of the design decisions that have been made so you can improve?

Even the most fundamental truths about software development are easy to forget, like that software development is rarely easy, and shouldn’t be. Just seeing the results from a management point of view, which must happen from time to time in order to effectively delegate implementation, the process looks much smoother, like a mountain range at 30,000 feet. But the smoothness is an illusion.

Management uses phrases like “keeping you hand dirty”, but I still think in terms of being a “real software developer” so I can help make better software.

I only want to work with other developers who are constantly trying to improve. The developers that cause me the most grief are those that are content to do things the same way over and over again regardless of the results.

The good news is that most of the excellent team I work with share my passion for improvement. In the past two years we have gone from non-repeatable builds and misuse of source code control to a smooth build process and logical branch management. Recently we have added RSS feeds of both builds and CVS checkins. To top it off we now have lava lamps to keep tabs on build results (as a mature product we have several active branches/supported versions so we need lots of lamps).

Autopilots off, feedback loop closed, self critique ongoing — who’s with me?

Robert Martin hits the nail on the head about craftsmanship

Robert Martin, of XP fame, really hit the nail on the head in this [http://www.butunclebob.com/ArticleS.UncleBob.TheNextBigThing article].

His basic premise is that what the industry needs is more craftsmanship and professionalism, and not another silver bullet to go chasing after.

I may post his last paragraph to my cube wall. Part of it reads:

I hope the next big thing is the growth of professionalism and craftsmanship, and the realization that these are the attributes, not documented process or raw manpower, that will make our industry productive, accurate, and respected.