mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Escape yas-selected-text for new snippet.
* yasnippet.el (yas-escape-text): New function. (yas-new-snippet-default): Call it on yas-selected-text. Close #709.
This commit is contained in:
parent
8ca8c7de4f
commit
8907fd1d42
@ -207,7 +207,7 @@ created with `yas-new-snippet'. "
|
||||
# name: $1
|
||||
# key: ${2:${1:$(yas--key-from-desc yas-text)}}
|
||||
# --
|
||||
$0`yas-selected-text`"
|
||||
$0`(yas-escape-text yas-selected-text)`"
|
||||
"Default snippet to use when creating a new snippet.
|
||||
If nil, don't use any snippet."
|
||||
:type 'string
|
||||
@ -1926,6 +1926,11 @@ foo\"bar\\! -> \"foo\\\"bar\\\\!\""
|
||||
string
|
||||
t)
|
||||
"\""))
|
||||
|
||||
(defun yas-escape-text (text)
|
||||
"Escape TEXT for snippet."
|
||||
(replace-regexp-in-string "[\\$]" "\\\\\\&" text))
|
||||
|
||||
|
||||
;;; Snippet compilation function
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user