A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tomterl/repl-toggle below:

tomterl/repl-toggle: Switch to/from repl buffer for current major-mode

Development takes now place at sourcehut: https://sr.ht/~tomterl/tomtel/ .

Switch from code buffers to the corresponding REPL

This is a generalization of an idea by Mickey Petersen of masteringemacs fame:

Use one keystroke to jump from a code buffer to the corresponding repl buffer and back again.

This works even if you do other stuff in between, as the last buffer used to jump to a repl is stored in a buffer local variable in the repl buffer.

`repl-toggle-mode` will automatically be activated for `prog-mode` major modes and configured and the started repl-buffers.

There are no repl/mode combinations preconfigured, put something like the following in your emacs setup for php and elisp repl:

(setq rtog/fullscreen t)
(require 'repl-toggle)
(setq rtog/mode-repl-alist '((php-mode . php-boris) (emacs-lisp-mode . ielm)))

This defines a global minor mode, indicated with ‘rt’ in the modeline, that grabs “C-c C-z” as repl toggling key-binding. I don’t know with which repl modes this actually works. If you use this mode, please tell me your rtog/mode-repl-alist, so that I can update the documentation.

pop or switch: rtog/goto-buffer-fun

Emacs – of course – has more than one function to switch between buffers. You can customize rtog/goto-buffer-fun to accommodate your needs. The default is switch-to-buffer; to move focus to another frame that already shows the other buffer, instead of switching the current frame to it, use pop-to-buffer.

(setq rtog/goto-buffer-fun 'pop-to-buffer)

Configurations known to work

If the mode you want to use doesn’t jump to an existing repl-buffer, but always starts a new one, you can use `rtog/switch-to-shell-buffer’ in your configuration to get that behaviour, e.g. for `octave-mode’:

(rtog/add-repl 'octave-mode (rtog/switch-to-shell-buffer 'inferior-octave-buffer 'inferior-octave))
(rtog/add-repl 'groovy-mode (rtog/switch-to-shell-buffer "*groovy*" 'run-groovy))
Pass code at point to the REPL

When you supply the universal prefix argument to the switching function,

to the repl buffer you switch to.

If you set rtog/fullscreen to true, the repl-commands will be executed fullscreen, i.e. as single frame, restoring the window-layout on switching back to the originating buffer.

(setq rtog/fullscreen t)

The custom variable rtog/fallback-repl can be customized with a function; this function will be called if no REPL is associated with the current buffers major mode.

Call repl-commands interactively

If the custom variable rtog/interactivep is set to t, repl-commands will be called interactively if possible.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4