Inserting Quotation Marks In Emacs Revisited

The other day, I wrote about Inserting Quotation Marks In Emacs Org Mode and I wrote a little bit of elisp to insert \ldquo{}\rdquo in the buffer and then place the point between the two quote commands. I remarked at the time that what I’d really like is to just insert “” so that the quotes would work anywhere not just in an Org mode buffer. When I tested that, however, Org mode thought the buffer encoding was something besides UTF-8 and got confused.

After a bit of prodding by Xah Lee, I decided to figure out what was going on. I couldn’t find anything wrong and when I tested again everything worked fine. Somehow or other I must have set the wrong encoding and that’s why the Org mode exporter complained. When my language environment is set to UTF-8, everything works as expected. Thus I’ve added

(set-language-environment "UTF-8")

to my init.el file and I’ve changed my dq function to

(defun dq ()
  "Insert double quotes in an org buffer."
  (interactive)
  (insert "“”")
  (backward-char))
This entry was posted in Programming and tagged , . Bookmark the permalink.