How to invoke ess (R in emacs) on Windows? - emacs

ESS is a fantistic package, and it works great on linux. When I run emacs + ess + R on Windows, the usual way M-x R failed to start R. It says: "No Match".
I can start it with an extra step:
M-x ess-smart-equals insert an equal sign in the scratch buffer.
M-x R, this time, it works.
I guess I need to active it somewhere, but I don't know how.
I also tried to open an .R file, place the cursor on a line of R code, and hit ctrl-enter to run it. Again, it doesn't work.
Windows 7 64-bit
GNU Emacs 24.5.1 (x86_64-w64-mingw32) of 2015-05-17 on KAEL
ess-version: 15.09-devel [elpa: 20150708.1130] (loaded from c:/Users/Nick/.emacs.d/elpa/ess-20150708.1130/)
Is there any configuration I need to do 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 Mode Line Click Change Buffer

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.

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

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.

How can i paste the selected region outside of emacs?

I am using Mac OS and emacs -nw (the terminal mode).
I don't know how can I paste things (having been implemented by M-w in emacs -nw) outside the emacs.
I know that the emacs -ns can do it.
Searching the internet and the command C-h b, i find out that method, but it didn't work out.
(setq x-select-enable-clipboard t)
(setq interprogram-cut-function 'x-select-text)
I don't know much about the argument of interprogram-cut-function.
Where does the x-select-text come from and what does it mean?
If you are using Ubuntu 12.04 or Fedora 21, there are a couple of options to make this work.
First you need to install xclip
sudo apt-get install xclip
First Option: For Emacs 24
If you are using emacs24 you can install from the list of packages
M-x package-list-packages
Select
xclip //mine was version 1.3
In your .emacs add:
(xclip-mode 1)
Second Option. For emacs before version 24
Install xclip.el:
Integrating Emacs with the X11 Clipboard in Linux
Third Option. Using #Nicholas Riley code shown in the answer
To use the code in the answer you need
pbcopy / pbpaste in Ubuntu (command line clipboard)
x-select-text is only used if you're running Emacs in a GUI. (Emacs maps the Mac/Windows pasteboard/clipboard APIs to the X11 model, hence the name). You can always use C-h f to find out more about a function like this one and view its definition if it's written in elisp.
On the Mac, there is no concept of CLIPBOARD versus PRIMARY selections, so there is no point in setting x-select-enable-clipboard.
The whole point of running emacs -nw is that it doesn't interact with the windowing system. Why use Emacs in a terminal when there are plenty of graphical Emacsen that work very nicely on the Mac?
That said, if you really wanted to hook up terminal Emacs to the Mac pasteboard, you could do something like this:
(setq interprogram-cut-function
(lambda (text &optional push)
(let* ((process-connection-type nil)
(pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy")))
(process-send-string pbproxy text)
(process-send-eof pbproxy))))
If you want a way to place the contents of the emacs region onto the clipboard only sometimes, as opposed to every time you do an emacs yank (which causes the clipboard contents the be overwitten all the time), you should check this answer to a related question:
https://stackoverflow.com/a/19625063/3363328
I found that it solved my problem much better than setting xclip mode.