From a1a4bfc7733a35bdf0037fa8ef12a2ec13fa1372 Mon Sep 17 00:00:00 2001 From: capitaomorte Date: Wed, 15 Jul 2009 07:02:13 +0000 Subject: [PATCH] * "$>" now working * `yas/hippie-try-expand' fixed to work with new undo system --- yasnippet.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 3e26f72..37bf2b0 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -66,11 +66,13 @@ other values interactively." The following values are possible: -`nothing' Don't apply any indendation after expansion; - `fixed' Indent the snippet to the current column; -`auto' Indent each line of the snippet with `indent-according-to-mode'" +`auto' Indent each line of the snippet with `indent-according-to-mode' + +Every other value means don't apply any snippet-side indendation +after expansion (the manual per-line \"$>\" indentation still +applies)." :type '(choice (const :tag "Nothing" nothing) (const :tag "Fixed" fixed) (const :tag "Auto" auto)) @@ -913,12 +915,7 @@ when the condition evaluated to non-nil." (if (not first-time?) (let ((yas/fallback-behavior 'return-nil)) (yas/expand)) - (when (and (null (car buffer-undo-list)) - (eq 'apply - (car (cadr buffer-undo-list))) - (eq 'yas/undo-expand-snippet - (cadr (cadr buffer-undo-list)))) - (undo 1)) + (undo 1) nil)) (defun yas/require-template-condition () @@ -1736,7 +1733,12 @@ Meant to be called in a narrowed buffer, does various passes" ;; (set-marker (yas/snippet-exit snippet) (point)))))) (t - nil))) + nil)) + (while (re-search-forward "$>" nil t) + (delete-region (match-beginning 0) (match-end 0)) + (when (not (eq yas/indent-line 'auto)) + (indent-according-to-mode)))) + (defun yas/escape-string (escaped) (concat "YASESCAPE" (format "%d" escaped) "PROTECTGUARD"))