branch: master
commit 55c448b9912fb65e449120e4ec8dfdafb8633291
Author: Noam Postavsky <[email protected]>
Commit: Noam Postavsky <[email protected]>
Remove redundant arg to yas-expand-snippet
* yasnippet.el (yas--expand-or-visit-from-menu)
(yas--expand-or-prompt-for-template)
(yas-visit-snippet-file, yas-tryout-snippet): Don't pass expand-env
when to yas-expand-snippet when first arg is a yas--template record.
---
yasnippet.el | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 27df486..bd915ef 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -1692,10 +1692,8 @@ Here's a list of currently recognized directives:
(let ((where (if (region-active-p)
(cons (region-beginning) (region-end))
(cons (point) (point)))))
- (yas-expand-snippet (yas--template-content yas--current-template)
- (car where)
- (cdr where)
- (yas--template-expand-env
yas--current-template)))))))
+ (yas-expand-snippet yas--current-template
+ (car where) (cdr where)))))))
(defun yas--key-from-desc (text)
"Return a yasnippet key from a description string TEXT."
@@ -2400,14 +2398,12 @@ template objects if CMD is nil (this is useful as a
more general predicate)."
Prompt the user if TEMPLATES has more than one element, else
expand immediately. Common gateway for
`yas-expand-from-trigger-key' and `yas-expand-from-keymap'."
- (let ((yas--current-template (or (and (cl-rest templates) ;; more than one
- (yas--prompt-for-template (mapcar
#'cdr templates)))
- (cdar templates))))
+ (let ((yas--current-template
+ (or (and (cl-rest templates) ;; more than one
+ (yas--prompt-for-template (mapcar #'cdr templates)))
+ (cdar templates))))
(when yas--current-template
- (yas-expand-snippet (yas--template-content yas--current-template)
- start
- end
- (yas--template-expand-env yas--current-template)))))
+ (yas-expand-snippet yas--current-template start end))))
;; Apropos the trigger key and the fallback binding:
;;
@@ -2552,10 +2548,7 @@ by condition."
(cons (region-beginning) (region-end))
(cons (point) (point)))))
(if yas--current-template
- (yas-expand-snippet (yas--template-content yas--current-template)
- (car where)
- (cdr where)
- (yas--template-expand-env yas--current-template))
+ (yas-expand-snippet yas--current-template (car where) (cdr where))
(yas--message 1 "No snippets can be inserted here!"))))
(defun yas-visit-snippet-file ()
@@ -2843,17 +2836,17 @@ DEBUG is for debugging the YASnippet engine itself."
:name (nth 2 parsed)
:expand-env (nth 5 parsed)))))
(cond (yas--current-template
- (let ((buffer-name (format "*testing snippet: %s*"
(yas--template-name yas--current-template))))
+ (let ((buffer-name
+ (format "*testing snippet: %s*"
+ (yas--template-name yas--current-template))))
(kill-buffer (get-buffer-create buffer-name))
(switch-to-buffer (get-buffer-create buffer-name))
(setq buffer-undo-list nil)
(condition-case nil (funcall test-mode) (error nil))
(yas-minor-mode 1)
(setq buffer-read-only nil)
- (yas-expand-snippet (yas--template-content yas--current-template)
- (point-min)
- (point-max)
- (yas--template-expand-env
yas--current-template))
+ (yas-expand-snippet yas--current-template
+ (point-min) (point-max))
(when (and debug
(require 'yasnippet-debug nil t))
(yas-debug-snippets "*YASnippet trace*" 'snippet-navigation)