excellent rgb! i have kept your original function as it is nice anyway,
but modified it to this:

(defmacro my-bothbraces-if-double (new-txt)
  "If the last key is the same as this key, insert new-txt and go back
a char"
  `(lambda (cnt)
     (interactive "p")
     (if (equal (preceding-char) last-command-char)
         (progn
           (insert ,new-txt)
           (backward-char))
       (self-insert-command cnt))))
(global-set-key "\"" (my-bothbraces-if-double "\""))
(global-set-key "\'" (my-bothbraces-if-double "\'"))
(global-set-key "\{" (my-bothbraces-if-double "\}"))
(global-set-key "\[" (my-bothbraces-if-double "\]"))
(global-set-key "\(" (my-bothbraces-if-double "\)"))
(global-set-key "\<" (my-bothbraces-if-double "\>"))

i hope it helps others!

_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to