As I was writing yesterday’s post I started to enter \rdquo{}
to get an opening double quotation mark for what seemed like the millionth time. I suddenly realized that this was really stupid and a waste of time so I cooked up a small amount of Emacs Lisp to do the job for me. Before I start, let me state for the record that I know about yasnippet
and know that I can do the same thing with it. The thing is, I don’t have it installed and I don’t think I’d use it for anything other than implementing the quotation mark template so a tiny bit of elisp seemed like a better solution.
The code itself is very simple
(defun dq () "Insert double quotes in an org buffer." (interactive) (insert "\\ldquo{}\\rdquo") (backward-char 6))
When dq
is called, the string \ldquo{}\rdquo
is inserted into the buffer and the point is moved backwards 6 characters so that it is between the two quote commands. All I need do then is type the material to be quoted and do a 【Meta+f】 to jump over the \rdquo
.
I thought about just having dq
insert “” so that I’d have a more general solution but when I tested that idea the Org mode exporter (or Emacs, I’m not sure which) got confused about the character encoding and asked me some questions. Rather than deal with that every time I wanted to insert quotation marks, I just stuck with what I’ve always done but with a little automation.
I’m sure there are other ways of addressing this problem in Emacs but I’m a programmer and the problem looked like a nail to me so I hit it with my favorite hammer. Feel free to cure me of my ignorance in the comments.
Update: Added missing “I”