irb command history keystroke in irb on eshell - emacs

How can I access the command history when running irb in the emacs eshell?
When I run irb at the command line outside of emacs, I can use the up arrow to get the last command or ctrl-r to search the command history. In irb inside eshell, the up arrow does nothing (i.e. it runs eshell-previous-matching-input-from-input which does nothing in irb) and ctrl-r uses the emacs reverse search of the buffer instead of searching the command history. I guess irb never receives the up-arrow keystroke because it's bound to eshell-previous-matching-input-from-input, but I'm not sure how to fix it. Running (global-unset-key (kbd "<up>")) doesn't unbind the up-arrow in eshell and I'm not sure that's desirable anyway.
I know about inf-ruby, but I prefer using irb in eshell and besides up-arrow and ctrl-r don't work with that either.
It could be a problem with readline in irb, but I don't think so. conf.use_readline is nil on the commandline where irb command history works fine. Running irb --readline in eshell switches conf.use_readline to true but doesn't fix the up arrow or ctrl-r.

Emacs term mode (M-x term) in combination with C-c C-j / C-c C-k to temporarily allow yanking seems to be a good option. See another answer here.

Related

How do I exit Emacs from the terminal?

I just installed Emacs 26.3 on Ubuntu 20.04. I opened a buffer in the terminal, and I cannot close it. C-x C-c does nothing. f10 to activate the menu does not activate the menu.
I'm using a .emacs file that maps cut/copy/paste commands to the normal C-x/C-c/C-v. I don't think that this can affect the issue, however, because I have the exact same setup (including the same .emacs file) on by Emacs 24.5/Ubuntu 16.04 laptop, and it has no problem exiting with C-x C-c. Also, I had the exact same problem before I installed the .emacs file on the new system.
How do I kill Emacs?
This question exists, but it has no useful answers.
ESC x save-buffers-kill-terminal
OFC binding C-x will affect C-x C-c. You don't need to know anything about Emacs to realize the problem. Just think twice.

Emacs Slime - Comma doesn't work

I have emacs 24.5.1 on windows with slime installed. I am using sbcl for lisp. When I open up slime, it works, but whenever I try to use comma to invoke a command, it just enters a comma. I can't get to the slime command menu. Is there any other way to get to the command menu besides comma?
Found the solution.
When going to the slime git website, they said you should include this in your initialization file
(setq slime-contribs '(slime-fancy))
It works after adding that to init.el (equivalent of .emacs)

How do I control emacs from a terminal?

I'm trying to drive emacs on OSX using Dragon Naturally Speaking running inside a Windows VM. Rather than running emacs in the VM, I'd like to drive an emacs (built from the HEAD of the repository) already running on the mac side of things. So, after a hunt through the emacs lisp manual I came up with the following snippets of lisp (currently running from the scratch buffer while I work stuff out):
;; This part is run from an emacsclient -t session
(defvar slave-frame last-event-frame)
;; and this is run in a GUI frame
(defadvice handle-switch-frame (after update-slave-redirect-advice activate)
(unless (eq last-event-frame slave-frame)
(redirect-frame-focus slave-frame last-event-frame)))
And all is well. I type into the terminal window, displaying buffer A and my typing appears in the GUI frame busily dsplaying buffer B. Great. Until I do C-x C-f or any other command that needs the minibuffer, at which point I get the error Terminal 1 is locked, cannot read from it.
I'm I barking up the wrong tree here, or is there a way to make redirect-frame-focus work nicely with commands that use the minibuffer?
Piers,
What behavior do you want, redirection to a minibuffer on the (Windows) client or a minibuffer on the server? Also, what version/flavor of emacs are you using?

In emacs, query-replace-regexp keyboard shortcut doesn't work in the terminal (e.g., emacs -nw)

Is it expected that C-M-% and ESC C-% do not run the command query-replace-regexp when running emacs in a terminal window (for example, emacs -nw)?
According to describe-function the binding exists, but emacs runs query-replace instead (which has the binding M-%). This has happened on several machines I've tried it on, and does not happen when I run emacs in a window.
The problem is that C-% simply can't be typed in a terminal. The only control sequences available are those that corresponds to ascii-code 0-31, mainly C-letter.
I have created a new shortcut in my .emacs file.
(global-set-key "\M-q" 'query-replace-regexp)
Control-Alt-Shift-% all together works on Windows and Fedora Linux. Does your keyboard have all those keys?

How can I abort an evaluation in Clojure Box (Emacs)?

I've been caught up in long running computations lately thanks to Project Euler and I'd like to know how to abort an evaluation and return to the REPL prompt. I'm running the standard Clojure Box version of Emacs. I tried the obvious REPL > Interrupt Lisp Process and Slime > Interrupt Command but neither kill the execution and return my REPL prompt.
Hit control c twice. If you're in *slime-repl clojure* then C-c C-c will kill the process and return you to the repl prompt. If you're in the *inferior-lisp* buffer, then you'll probably kill the clojure process, meaning that you'll have to restart slime (with M-x slime). If you don't have a slime repl buffer then, M-x slime-repl should give you one. You can use this as a repl to get a few extra features (try pressing the comma and tab, and see what's available ;)
When things get really fowled you can kill your lisp instance with M-x slime-quit-lisp and then restart it with M-x slime