+(defun yas--skip-and-clear-field-p (field _beg _end &optional _length)
+ "Tell if newly modified FIELD should be cleared and skipped.
+BEG, END and LENGTH like overlay modification hooks."
+ (and (not (yas--field-modified-p field))
+ (= (point) (yas--field-start field))
+ (require 'delsel)
+ ;; `yank' sets `this-command' to t during execution.
+ (let* ((command (if (commandp this-command) this-command
+ this-original-command))
+ (clearp (if (symbolp command) (get command 'delete-selection))))
+ (when (and (not (memq clearp '(yank supersede kill)))
+ (functionp clearp))
+ (setq clearp (funcall clearp)))
+ clearp)))
+
+(defun yas--on-field-overlay-modification (overlay after? beg end &optional length)