From 35642ac007a63aa7bc6c50fc6fc5688bfb3b057b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 11 Oct 2015 21:23:36 -0400 Subject: [PATCH] Simplify string matching. * yasnippet.el (yas--field-parse-create): Use string-match-p to instead of save-match-data, anchor regexp with \` (start of string) to instead of (eq ... 0) --- yasnippet.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 50973e9..77702eb 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -4049,9 +4049,8 @@ When multiple expressions are found, only the last one counts." ;; after the ":", this will be ;; caught as a mirror with ;; transform later. - (not (save-match-data - (eq (string-match "$[ \t\n]*(" - (match-string-no-properties 2)) 0))) + (not (string-match-p "\\`\\$[ \t\n]*(" + (match-string-no-properties 2))) ;; allow ${0: some exit text} ;; (not (and number (zerop number))) (yas--make-field number