Skip to content

Commit a73cc7d

Browse files
committed
tweak(octave): better integration of octave with eros
1 parent 6e72f12 commit a73cc7d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

core/me-builtin.el

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -943,17 +943,18 @@ Typing these will trigger reindentation of the current line.")
943943
:mode ("\\.m\\'" . octave-maybe-mode)
944944
:config
945945
(defun +octave-eval-last-sexp ()
946-
"Evaluate Octave sexp before point and print value into current buffer."
946+
"Like `octave-eval-print-last-sexp', but it doesn't print to the buffer."
947947
(interactive)
948948
(inferior-octave t)
949-
(let ((print-escape-newlines nil)
950-
(opoint (point)))
951-
(prin1
952-
(save-excursion
953-
(forward-sexp -1)
954-
(inferior-octave-send-list-and-digest
955-
(list (concat (buffer-substring-no-properties (point) opoint) "\n")))
956-
(mapconcat 'identity inferior-octave-output-list "\n"))))))
949+
(let* ((print-escape-newlines nil)
950+
(opoint (point))
951+
(result (save-excursion
952+
(forward-sexp -1)
953+
(inferior-octave-send-list-and-digest
954+
(list (concat (buffer-substring-no-properties (point) opoint) "\n")))
955+
(string-join inferior-octave-output-list "\n"))))
956+
(when (called-interactively-p 'interactive) (message "%s" result))
957+
result)))
957958

958959
(use-package bookmark
959960
:custom

modules/me-emacs-lisp.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
(defun +eros-octave-eval-last-sexp ()
9999
"Wrapper for `+octave-eval-last-sexp' that overlays results."
100100
(interactive)
101-
(eros--eval-overlay (+octave-eval-last-sexp) (point)))))
101+
(eros--make-result-overlay (+octave-eval-last-sexp) :where (point) :duration eros-eval-result-duration))))
102102

103103

104104
;; Elisp regexp mistake finder

0 commit comments

Comments
 (0)