gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nice-single-quote


From: Thien-Thi Nguyen
Subject: nice-single-quote
Date: Fri, 16 Apr 2010 10:40:20 +0200

Greetings earthlings,

I've taken a fancy to the Unicode

 #x2018 -- LEFT SINGLE QUOTATION MARK
 #x2019 -- RIGHT SINGLE QUOTATION MARK

for quoting sexps in various non-user-message text (comments,
ChangeLog, NEWS, etc).  Please find below a simple command that
inserts these, as well as my preferred keybinding.  Example usage:

 Originally
   // Use super-foo

 Type C-'
   // Use super-‘foo’

 Some seconds later, after more typing
   // Use super-‘foo’ to bar LAX (laughter)

 Type C-u 2 C-'
   // Use super-‘foo’ to bar ‘LAX (laughter)’

(The fragments are from a buffer in C mode, w/ point always at eol.)

thi

_______________________________________________________________________
;; Copyright (C) 2010 Thien-Thi Nguyen
;; This program is provided under GNU GPLv3+.

(defun nice-single-quote (&optional n)
  "Insert ‘ and ’ around the last N sexps; leave point at end.
N defaults to 1."
  (interactive "p")
  (save-excursion
    (backward-sexp (or n 1))
    (insert "‘"))
  (insert "’"))

(global-set-key [(control ?')] 'nice-single-quote)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]