Emacs Mode Line Click Change Buffer - emacs

In some installation of Emacs for the terminal, I had that if you click (text mouse cursor) on the buffer name in the mode line it jumped to the next buffer.
I search for a while but I couldn't find it.
Do someone remembers how to achieve this.
OS : OS X Terminal
Emacs: GNU Emacs 26.3
(Now I have Catalina, but I should have been in previous versions)

Try turning on mouse mode in your terminal emacs: M-x xterm-mouse-mode RET. This seems to work with emacs -nw in either an xterm or a gnome-terminal on linux. Whether it works on OS X and whatever terminal emulator it provides, I have no idea.
This Unix & Linux SE question contains much more information and some useful links.

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.

How to configure simpleclip in emacs terminal mode to copy-paste interchangeably with OS?

I'm using emacs -nw (Emacs 24.5, Ubuntu 16.04). And I found that the default emacs M-w C-y keys don't work interchangeably with the operating system.
After some research, it seems that the most comprehensive solution is to use simpleclip. EmacsWiki says that
simpleclip
You can use https://github.com/rolandwalker/simpleclip which ALWAYS
works.
But looking into its usage guide above, simpleclip makes use of a set of keys that are completely different from the default M-w C-y or the OS Ctrl-Shift-c, Ctrl-Shift-v for copy-paste
;; Press super-c to copy without affecting the kill ring.
;; Press super-x or super-v to cut or paste.
I don't really want to use super key a lot with my PC keyboards, and don't want to remember (or persuade others to remember) yet another set of copy-paste keys.
For the GUI emacs, I can copy something in emacs and paste it into another terminal without any configuration. Mostly, I don't feel that Emacs is any different from gedit except that the emacs copy-paste keys M-w C-y can be used in addition.
In the terminal mode, most of it breaks down. If I use OS copy (Ctrl-Shift-c), one line in emacs can be copied into two or more lines in a target terminal because the line is too long. contents copied using M-w simply do not paste into other programs, even though I tried to set certain variables following other SO questions, e.g.:
(setq x-select-enable-clipboard t)
I'm not very familiar with elisp. My question:
How can I customize or configure simpleclip so that copy-paste in emacs -nw is exactly the same as copy-paste in the OS?
Other related SO questions:
How to copy text from Emacs to another application on Linux
emacs terminal mode: how to copy and paste efficiently
I recommend you use the xclip package, which you can install from GNU ELPA (i.e. via M-x package-list-packages). It requires installation of the xclip utility under X11 (e.g. via aptitude install xclip) and uses the pbcopy/pbpaste under macOS.

copy/paste from emacs in command line

I run emacs from command line using the command emacs -nw
However when I do this, and I try to copy paste something from, say, my browser to my emacs session, it returns me the error "kill ring is empty".
Can someone please let me know how I can copy/paste this way? Thanks.
Programs run in terminal sessions don't have access to the windowing system clipboard. Use the cut and paste functionality provided by your terminal emulator. For example, in Gnome's terminal program press C-S-v (shift-control-V) to paste.
Alternatively, if you're using X11 you can use the xsel program to access the X selection. For example, this function will paste the current X selection into the current buffer:
(defun paste-from-x ()
(interactive)
(call-process "xsel" nil t))
Does marking the text you want to copy with the mouse and then pressing Shift-Insert in Emacs work for you?
I think this previous answer of mine might help you:
First you need to install xclip
sudo apt-get install xclip
For Emacs 24
M-x package-list-packages
Select
xclip //mine was version 1.3
Detailed info and other operating systems
https://stackoverflow.com/a/14659015/54848

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?

Emacs and chord translation

I'm having some issues with emacs, in particular when using SLIME. It's not reading the slime-eval-defun command (bound to C-M-x) but will read C-M-S-x... same issue with the indent function C-X-q, I have to add a shift to make it work.
When looking into the key bindings I get this
C-M-x (translated from C-M-S-x) runs the command slime-eval-defun,
which is an interactive Lisp function in `slime.el'.
So it picks up C-M-S-x and assumes that I want C-M-x, which is true, but I'm not getting why it's not picking up C-M-x in the first place!
I'm running emacs on Arch as a guest OS, host OS is OS X.
So I found out that the KDE default shortcut for activating clipboard actions is C-M-x. I removed that and the SLIME shortcut works now.