elisp - In Emacs can you evaluate an Emacs Lisp expression and replace it with the result? -
For example if I have the text:
Sum of items (+ 1 2 3)
I want to move at the end of the line, evaluate the expression and replace it with the result, so that it can read:
Cu Cx Ce
In the / kbd> buffer, the preceding parentheses will include the value of the expression. You can do this, then manually back up and delete the original expression. If this is a lot of work, then here is a command that evaluates the preceding expression and changes it with its value: (defun replace-last-sexp () (interactive) (Two (value (eval (predecessor-sexp)) (kill-sex-1) (insert (format "% S" value)))
Comments
Post a Comment