branch: externals/objed
commit a09e198663878faf5b8f363ddc5fc88b47e5a72f
Author: Clemens Radermacher <clem...@posteo.net>
Commit: Clemens Radermacher <clem...@posteo.net>

    Improve objed-eval-exp
---
 objed.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/objed.el b/objed.el
index 9d88553..788214f 100644
--- a/objed.el
+++ b/objed.el
@@ -2799,8 +2799,9 @@ If REPLACE is non-nil replace the region with the result."
             (if (not replace)
                 str
               (when str
-                (delete-region beg end)
-                (insert str)))))))))
+                (prog1 str
+                  (delete-region beg end)
+                  (insert str))))))))))
 
 
 ;; TODO: toggle like fill/unfill
@@ -2874,7 +2875,7 @@ If REPLACE is non-nil replace evaluated code with result."
   "Eval expression at point, fallback to defun.
 
 If REPLACE is non-nil replace evaluated code with result."
-  (interactive)
+  (interactive "P")
   (let* ((obj (cond ((objed--at-object-p 'bracket)
                        'bracket)
                     ((or (objed--at-object-p 'identifier)
@@ -2884,10 +2885,12 @@ If REPLACE is non-nil replace evaluated code with 
result."
          (odata (objed--get-object obj))
          (res (and odata
                    (apply 'objed--eval-func
-                     (append (objed--current odata) (list replace))))))
+                          (append (objed--current odata) (list replace))))))
+    (if replace
+        (objed--switch-to 'char)
       (when res
         (prog1 res
-          (objed--switch-to obj nil odata)))))
+          (objed--switch-to obj nil odata))))))
 
 
 (defun objed-pipe-region (beg end cmd &optional variant)

Reply via email to