* Getting there, getting there, `yas/push-undo-action-maybe' has to be

modified to adapt to new arg list and use `pushnew'

* A `yas/cleanup-snippet' action has to be pushed on `yas/expand' 

* expanding a new snippet with a snippet already active must render
  the previous one disabled. This shouldn't be a field, it should be
  found out on the fly. disabled means its big overlay is coloured
  some other color.

* transformations have to be accounted for

* code has to be cleaned up and thoroughly commented.
This commit is contained in:
capitaomorte 2008-09-18 21:43:28 +00:00
parent d117ee3857
commit 9fa6f3533e

View File

@ -1477,12 +1477,12 @@ snippet as ordinary text"
;; forget all other pending undo actions and push a undo/redo
;; action for snippet revival
;;
(setq yas/pending-undo-actions nil)
(yas/push-undo-action-maybe (list 'yas/revive-snippet
snippet
yas/snippet-beg
yas/snippet-end
(yas/snippet-active-group snippet)))
(setq yas/pending-undo-actions (list
(list 'above-all
`(yas/revive-snippet ,snippet
,yas/snippet-beg
,yas/snippet-end
,(yas/snippet-active-group snippet)))))
;;
;; XXX: `yas/after-exit-snippet-hook' should be run with
;; `yas/snippet-beg' and `yas/snippet-end' bound. That might not
@ -1549,18 +1549,20 @@ performed in `yas/correct-undo-list', which is placed in the
;;
;; Save boundaries of current field
;;
(push (list 'yas/restore-group-boundaries
(push (list 'after-first-action
(list 'yas/restore-group-boundaries
group
snippet
(overlay-start field-overlay)
(overlay-end field-overlay))
(overlay-end field-overlay)))
yas/pending-undo-actions)
;;
;; Save a reference to current group
;;
(push (list 'yas/restore-active-group
(push (list 'after-first-action
(list 'yas/restore-active-group
group
snippet)
snippet))
yas/pending-undo-actions)))
(defun yas/revive-snippet (snippet snippet-start snippet-end active-group)
@ -1582,7 +1584,7 @@ performed in `yas/correct-undo-list', which is placed in the
;;
;; Reregister this snippet
;;
(yas/register-snippet snipept))
(yas/register-snippet snippet))
(defun yas/restore-active-group (group snippet)
"..."
@ -1605,14 +1607,17 @@ performed in `yas/correct-undo-list', which is placed in the
(<= point (yas/field-end field)))))
(defun yas/correct-undo-list ()
(mapcar #'yas/push-undo-action-maybe yas/pending-undo-actions))
(mapcar #'(lambda (args)
(apply #'yas/push-undo-action-maybe args))
yas/pending-undo-actions))
(defun yas/push-undo-action-maybe (apply-args)
(defun yas/push-undo-action-maybe (how apply-args &optional jump-first-separator)
"..."
(let ((undo-list buffer-undo-list)
(target-separator nil)
done)
(unless (eq t buffer-undo-list)
(cond ((eq how 'after-first-action)
;;
;; Discard possibly existing/missing start separator
;;
@ -1640,7 +1645,7 @@ performed in `yas/correct-undo-list', which is placed in the
(setf (cdr undo-list)
(cons (cons 'apply
apply-args)
target-separator))))))
target-separator))))))))
(defun yas/sanitize-undo-redo ()
(let ((undo-list buffer-undo-list)