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

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

nice-single-quote non-rt


From: Thien-Thi Nguyen
Subject: nice-single-quote non-rt
Date: Sat, 17 Apr 2010 07:31:04 +0200

greetings earthlings,

fav non-soc noted: nothing gold can stay;
cmd prev quoted needs push to find the Way:
  bow to reality deferential,
  lose transparency referential,
but grok the suffering of all who must stray.

thi

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

(defun nice-single-quote (&optional n)
  "Insert ‘ and ’ around the N sexps before point; leave point at end.
N defaults to 1.  Successive interactive calls (that set ‘last-command’)
behave differently, however: In that case, find the left single quote
and transpose it with the character preceding it."
  (interactive "p")
  (if (eq 'nice-single-quote last-command)
      (save-excursion
        (search-backward "‘")
        (transpose-chars 1))
    (save-excursion
      (backward-sexp (or n 1))
      (insert "‘"))
    (insert "’")))

;; This is more comfortable than ‘C-'’ following ‘M-/’.
(global-set-key [(meta ?')] 'nice-single-quote)




reply via email to

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