1 2 3 4 5 6 7 8 9 10
;; downloaded from https://github.com/magnars/.emacs.d/blob/master/defuns/lisp-defuns.el (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)))))