Improve prelude-eval-and-replace

This commit is contained in:
Bozhidar Batsov 2013-12-21 22:15:52 +02:00
parent 86ba702f48
commit fa6795b71f

View file

@ -297,12 +297,9 @@ there's a region, all lines that region covers will be duplicated."
(defun prelude-eval-and-replace () (defun prelude-eval-and-replace ()
"Replace the preceding sexp with its value." "Replace the preceding sexp with its value."
(interactive) (interactive)
(backward-kill-sexp) (let ((value (eval (preceding-sexp))))
(condition-case nil (backward-kill-sexp)
(prin1 (eval (read (current-kill 0))) (insert (format "%s" value))))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))
(defun prelude-recompile-init () (defun prelude-recompile-init ()
"Byte-compile all your dotfiles again." "Byte-compile all your dotfiles again."