eval-and-replace function added

This commit is contained in:
Sameer Rahmani 2015-09-24 17:21:21 +03:30
parent b80c53b5c0
commit 45ea6e1e4a
1 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,18 @@
"Tested with v0.6.1. Extracted from `yas/expand-1'"
(first (yas/current-key)))
(defun eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
(condition-case nil
(prin1 (eval (read (current-kill 0)))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))
;;;###autoload
(defun extension/development-initialize ()
"Development plugin initialization."