(Emacs+Org-Mode) If You Enjoy Writing Even A Little Bit With Emacs Then Add This Em-Dash Code Now

The EM-DASH provokes mixed feelings mostly in writers, and maybe readers if they notice it (probably the writers are the ones noticing it while reading). But the EM-DASH is a really nice way to break up a sentence when a COMMA or a SEMI-COLON or a COLON just won’t do it.

The usage advice out there keeps it really simple—when you use the EM-DASH don’t put any spaces between in and the text it is separating.

Here is the code—it deserves such a prime-placement as using CONTROL and your number row! Since it is so easy to add, set up EN-DASH, too.

(defun help/insert-em-dash ()
  "Inserts an EM-DASH (not a HYPEN, not an N-DASH)"
  (interactive)
  (insert "—"))
(defun help/insert-en-dash ()
  "Inserts an EN-DASH (not a HYPEN, not an EM-DASH)"
  (interactive)
  (insert "–"))
(global-set-key (kbd "C--") #'help/insert-em-dash)
(global-set-key (kbd "M--") #'help/insert-en-dash)
(global-set-key (kbd "C-M-y") #'insert-char)

Here is how they look: hypen EM-DASH EN-DASH

-
—
–

ADDENDUM 2018-03-22T17-26-55-05-00

  • Adds EN-DASH insertion
  • Adds C-M-y for “pasting any Unicode chars”

4 thoughts on “(Emacs+Org-Mode) If You Enjoy Writing Even A Little Bit With Emacs Then Add This Em-Dash Code Now”

  1. Perfect! Thank you so much. I use EM-DASHes all the time and it became second nature to just go for C-x 8 RET—absolutely dumb, of course, so this will make a big difference. Cheers!

    1. nmsalgueiro glad it helped.
      Just dawned one me that we may as well add EN-DASH, too.
      I always use C-M-y for #’insert-char because it is kind of like pasting. Mega pasting.

Leave a Reply

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