From 1fd5c9a8948ee3e7ca9e2f157fbffbb99940aa7a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 2 Nov 2014 18:46:38 +0100 Subject: [PATCH] bound bba/eval-last-sexp-replace to C-c E to replace the last s-expression with its evaluated result. Signed-off-by: Andreas Gerler --- bba.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bba.org b/bba.org index f416ad50..3758359d 100644 --- a/bba.org +++ b/bba.org @@ -1016,6 +1016,22 @@ window-total-height. #+END_SRC +*** [[http://stackoverflow.com/questions/3035337/in-emacs-can-you-evaluate-an-emacs-lisp-expression-and-replace-it-with-the-resul][eval emacs lisp expression and replace it]] + [2014-11-02 Sun 18:21] + +Use =C-c E= to evaluate and replace the last s-expression. + +#+BEGIN_SRC emacs-lisp + (defun bba/eval-last-sexp-replace () + "replace the last s-expression with its evaluated result" + (interactive) + (backward-kill-sexp) + (prin1 (eval (read (current-kill 0))) + (current-buffer))) + + (define-key global-map "\C-c\S-e" 'bba/eval-last-sexp-replace) +#+END_SRC + *** goto-match-paren #+BEGIN_SRC emacs-lisp (defun goto-match-paren (arg) -- 2.47.3