I created a yasnippet that calls a function:
# -*- mode: snippet -*- # name: print # key: pr # -- `(cperl-print)`
The function code:
(defun cperl-print () (interactive) (let* ((current (point)) (end (line-end-position))) (if (< current end) (insert "print") (progn (insert "print ;") (backward-char 1)) )))
backward-char doesn't produce any effect when called from inside yasnippet. When the function is called directly, it works. Is there any way to fix this?