How can mouse support be enabled in an Emacs terminal session started with emacs -nw? Is there a keyboard shortcut or a flag to do this? If not how can it be done in terminal emulators? I use Guake.
- 807,993
- 194
- 1,674
- 2,175
- 2,227
- 6
- 20
- 25
-
1Are you running `emacs` in a GUI terminal emulator? What kind of support do you need? Placing the cursor? Copy/pasting? – terdon Jan 03 '16 at 11:52
-
1[Emacs: Using a Mouse in Text Terminals](http://www.gnu.org/software/emacs/manual/html_node/emacs/Text_002dOnly-Mouse.html) – Mark Plotnick Jan 03 '16 at 11:56
-
1@terdon I am using guake. – user Jan 03 '16 at 11:56
-
OK, please [edit] your question and add that information. Also explain exactly what type of mouse support you need. – terdon Jan 03 '16 at 11:57
-
@MarkPlotnick that should be an answer. It's probably precisely what the OP needs. – terdon Jan 03 '16 at 11:58
-
@MarkPlotnick sorry I am new to emacs when I hit alt+x it goes in the bottom bar how do I run the command? Enter returns `' is not a valid command name – user Jan 03 '16 at 12:01
-
3@user Type ALT-X, then `xterm-mouse-mode`, then return. – Mark Plotnick Jan 03 '16 at 12:03
-
@MarkPlotnick IANAL but I really doubt there could be any licencing issue when quoting from an oficial manual! – terdon Jan 03 '16 at 15:33
-
@MarkPlotnick it worked – user Jan 03 '16 at 16:14
2 Answers
Hit F10 to open the menu and use the arrow keys to navigate to “Options” → “Customize Emacs” → “All Settings Matching…”. Type mouse and Enter.
If your Emacs version doesn't have a menu when running in a terminal then run M-x customize. (This means: press Alt+X, type customize and press Enter.) Navigate to the search box, type mouse and press Enter.
Mouse support is called “Xterm Mouse mode”. You can find that in the manual. The manual also gives a way to turn it on (for the current session) — M-x xterm-mouse-mode.
In the Customize interface, on the setting you want to change, press Enter on “Show Value”. A “Toggle” button appears, press Enter on it. Then press Enter on the “State” box and choose either 0 for “Set for Current Session” or “1” for “Save for Future Sessions”. (You can choose 0 for now and come back there and choose 1 later if you're happy with the setting.)
- 807,993
- 194
- 1,674
- 2,175
add (xterm-mouse-mode 1) to your ~/.emacs.d/init.el file.
- 66,199
- 35
- 114
- 250
- 361
- 3
- 2
-
Thanks! I was searching for that as my customizations menu is empty (I compiled it from the git sources, works well so far, so I'm happy with that) – runlevel0 Jul 31 '23 at 09:42