Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should yas-escape-text escape backquote "`"? #1198

Open
karta0807913 opened this issue May 11, 2024 · 0 comments
Open

should yas-escape-text escape backquote "`"? #1198

karta0807913 opened this issue May 11, 2024 · 0 comments

Comments

@karta0807913
Copy link

hello everyone, I notice that yas-escape-text function doesn't escape the backquote "`". Should we escape it?

yasnippet/yasnippet.el

Lines 2091 to 2094 in eb5ba26

(defun yas-escape-text (text)
"Escape TEXT for snippet."
(when text
(replace-regexp-in-string "[\\$]" "\\\\\\&" text)))

example code:

(yas-escape-text "`\\$") ;; output "`\\\\\\$"

I think we can change this function as follows to fix this problem.

 (defun yas-escape-text (text) 
   "Escape TEXT for snippet." 
   (when text 
     (replace-regexp-in-string "[`\\$]" "\\\\\\&" text))) 

system information

yasnippet version

20240406.1314

emacs version

GNU Emacs 29.2.50
Development version e95a8622263d on emacs-29 branch; build date 2024-03-24.
Copyright (C) 2024 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
@karta0807913 karta0807913 changed the title should yas-escape-text function escape backquote "`"? should yas-escape-text escape backquote "`"? May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant