From fffee76f7a764182e6e65790a835bfea540275ce Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 5 Jan 2019 16:55:01 -0500 Subject: [PATCH] feature/eval: update README (remove :repl) And use a simpler set-repl-handler! example. --- modules/feature/eval/README.org | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/modules/feature/eval/README.org b/modules/feature/eval/README.org index 2dfa8fac8..cfdad3535 100644 --- a/modules/feature/eval/README.org +++ b/modules/feature/eval/README.org @@ -67,26 +67,20 @@ default binding: =SPC o r=. These will open a REPL in a popup window. You can simply call that mode's REPL command manually. e.g. ~M-x ielm~, but #+end_quote -Otherwise, you can define your own for a specified major-mode with the =:repl= -setting. +Otherwise, you can define your own for a specified major mode: -~(set! :repl MAJOR-MODE FUNCTION)~ +~(set-repl-handler! MAJOR-MODE FUNCTION)~ -FUNCTION should be a command that opens a repl buffer. Any window changes are -ignored, then handed off to shackle (assuming shackle-mode is on) to display in -a popup window. +FUNCTION should return a repl buffer. Any window changes in this function are +ignored, then the REPL is opened in a popup window. #+BEGIN_SRC emacs-lisp -(defun +emacs-lisp/repl () +(defun +lua/repl () (interactive) - (pop-to-buffer - (or (get-buffer "*ielm*") - (progn (ielm) - (let ((buf (get-buffer "*ielm*"))) - (bury-buffer buf) - buf))))) + (lua-start-process "lua" "lua") + (pop-to-buffer lua-process-buffer)) -(set-repl-handler! 'emacs-lisp-mode #'+emacs-lisp/repl) +(set-repl-handler! 'lua-mode #'+lua/repl) #+END_SRC ** Change how code is evaluated in a major mode