Make the environment of elisp evaluation more friendly to (current-column)

This commit is contained in:
Zhang Chiyuan 2008-08-06 08:52:36 +00:00
parent 1ad8d82ac9
commit de67b5802f

View File

@ -430,6 +430,7 @@ a list of modes like this to help the judgement."
(save-excursion (save-excursion
(save-restriction (save-restriction
(save-match-data (save-match-data
(widen)
(format "%s" (eval (read string)))))) (format "%s" (eval (read string))))))
(error (format "(error in elisp evaluation: %s)" (error (format "(error in elisp evaluation: %s)"
(error-message-string err))))) (error-message-string err)))))
@ -620,6 +621,9 @@ will be deleted before inserting template."
;; Step 3: evaluate all backquotes ;; Step 3: evaluate all backquotes
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "`\\([^`]*\\)`" nil t) (while (re-search-forward "`\\([^`]*\\)`" nil t)
;; go back so that (current-column) in elisp code evaluation
;; will calculate to a meaningful value
(goto-char (match-beginning 0))
(replace-match (yas/eval-string (match-string-no-properties 1)) (replace-match (yas/eval-string (match-string-no-properties 1))
t t)) t t))