Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.84k stars 194 forks source link

Suggestion: make pairs for autoescaping in string configurable #32

Closed tkf closed 8 years ago

tkf commented 11 years ago

Currently it is hard-coded and only supports double quote. How about adding a configurable sp-autoescape-string-quotes which hold a list of pairs, like this:

(defcustom sp-autoescape-string-quotes '(("\"" "\""))
  ...)
(make-variable-buffer-local 'sp-autoescape-string-quotes)

It's always buffer local, so user can configure it in mode hook:

(add-hook 'python-mode-hook
          (lambda ()
            (setq sp-autoescape-string-quotes '(("\"" "\"") ("'" "'")))))

When it is added, we can remove sp-autoescape-string-quote (singular) because its redundant.

Fuco1 commented 11 years ago

I agree. I've mostly hardcoded it because I haven't thought about the modes where ' can be used :/ I hope the fix won't be very difficult.

But this is a lower-priority task for now, since during the exams I can only get to coding like one day a week. After the term is over I plan to do a bit of a refactoring (a lot actually), so other people can read the code and understand it, it will help with contributions :D This is actually my first project ever in elisp, so you can tell the older functions are quite a mess sometimes.

Fuco1 commented 8 years ago

This has now been added to version 1.8.