From 5f5e23c829d93756fca20565ed141128bd83dc41 Mon Sep 17 00:00:00 2001 From: capitaomorte Date: Mon, 6 Jul 2009 21:38:41 +0000 Subject: [PATCH] a minor change, having trouble debugging on mac --- snippets/text-mode/html-mode/dov | 3 +++ snippets/text-mode/objc-mode/prop | 3 ++- yasnippet.el | 13 ++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/snippets/text-mode/html-mode/dov b/snippets/text-mode/html-mode/dov index e444aee..e8341ea 100644 --- a/snippets/text-mode/html-mode/dov +++ b/snippets/text-mode/html-mode/dov @@ -1,5 +1,8 @@ #name : ... # -- +a mirror up here $3 + + $0 diff --git a/snippets/text-mode/objc-mode/prop b/snippets/text-mode/objc-mode/prop index 4d585db..f17ae13 100644 --- a/snippets/text-mode/objc-mode/prop +++ b/snippets/text-mode/objc-mode/prop @@ -1,8 +1,9 @@ #name : foo { ... } ; setFoo { ... } # -- -- (${1:id})${2:foo} +- ${1:id} ${2:foo and its ${3:nested} shit} { return $2; + // dont forget we have $3 } - (void)set${2:$(capitalize text)}:($1)aValue diff --git a/yasnippet.el b/yasnippet.el index 5c94f9d..f0668ff 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1059,20 +1059,20 @@ snippet, if so cleans up the whole snippet up." (dolist (snippet snippets) ;; TODO: handle nested field exceptions, smaller, more nested ;; find should come up earlier as `containing-field's - (let ((containing-field (find-if #'yas/field-contains-point-p (reverse (yas/snippet-fields snippet))))) - (cond ((not containing-field) + (let ((active-field (yas/snippet-active-field snippet))) + (cond ((not (and active-field (yas/field-contains-point-p active-field))) (yas/commit-snippet snippet)) - ((and containing-field + ((and active-field (or (not yas/active-field-overlay) (not (overlay-buffer yas/active-field-overlay)))) (save-excursion - (yas/move-to-field snippet containing-field))) + (yas/move-to-field snippet active-field))) (t nil)))))) (defun yas/field-contains-point-p (field) (and (>= (point) (yas/field-start field)) - (< (point) (yas/field-end field)))) + (<= (point) (yas/field-end field)))) (defun yas/pre-command-handler () ) @@ -1327,8 +1327,8 @@ Allows nested placeholder in the style of Textmate." (set-marker (yas/mirror-end mirror) (point))) - ;; Debug functions. Use (or change) at will whenever needed. +;; (defun yas/debug-some-vars () (interactive) @@ -1362,7 +1362,6 @@ Allows nested placeholder in the style of Textmate." (yas/load-directory "~/Source/yasnippet/snippets/") ;;(kill-buffer (get-buffer "*YAS TEST*")) (set-buffer (switch-to-buffer "*YAS TEST*")) - (yas/exterminate-snippets) (erase-buffer) (setq buffer-undo-list nil) (html-mode)