When I am running Emacs (in GUI mode) in GNOME, the meta key works fine i.e. alt-v jumps back one page.
But when I remove the line: "gnome-enable" from rc.conf and reboot FreeBSD then alt-v does not work in Emacs (although ctrl-v works). Doing alt-v in Emacs without GNOME simply prints v at the cursor. Yea... i can of course use esc as the meta key... but I would really love to use the alt / option key of my MacBook as the meta key.
I am running FreeBSD 8.1 on a MacBook.
Please help.
Thanks.
http://www.emacswiki.org/emacs/MetaKeyProblems goes into all (or most) of the ways that this can go wrong, and how to fix them. I don't have a gnome-enable locally, but I imagine that one of the things it does is (setq x-alt-keysym 'meta).
Related
It is my first time to use emacs -nw. But I have problem at the first when I type M-x. In the minibuffer, it shows "Mark set" instead of M-x
I don't know why it happens. How can I deal with it?
PS: My os is Macosx and I connect remote by using ssh and then I type emacs -nw but I cannot use M-x
Update:08/30/2015
When I see the options under M-x customize-group ns, it seems that Alt is actually used as Meta? Why it didn’t works.
14Hide Ns Alternate Modifier: [Value Menu] meta |
15 [ State ]: STANDARD. |
16 This variable describes the behavior of the alternate or option key. More |
37Hide Ns Right Alternate Modifier: [Value Menu] Use the value of ns-alternate-modifier |
38 [ State ]: STANDARD. |
39 This variable describes the behavior of the right alternate or option key. More |
When using Emacs in the terminal (switch -nw), you might not have a Meta key, depending on your platform etc. In particular, the Alt keyboard key might not function as the Meta key. You might find some information (e.g. here, or by googling) about how to get it working as Meta for your context (platform etc.), but you might not.
You can always use ESC (the Escape key) followed by a key to act the same as the Meta modifier applied to that key. For example, instead of M-x, you can use ESC x.
(You press and release ESC, and then do the same for x. ESC is not a modifier key -- you do not hold it pressed while hitting x.)
Your problem is that OSX is stealing the key. There are a few things which will make your life easier
Install emacs using homebrew. The version which comes with OSX is old
Use iterm2 instead of the default term.app - much better and feature rich
In iterm2, you can set a key override for either the left or right option as +ESC, which will make it all work.
This will all work on a local machine, but you may run into additional problems if your connecting to a remote machine and running emacs there. It is a similar problem, your key settings may no be getting stolen/dropped by the ssh session - all depends on your terminal, your ssh config and the remote system.
Note that with emacs, you often don't need to run remote. Emacs comes with a built-in system called Tramp, which is very powerful. Using tramp, you can open remote directories and edit the files as if they were local files. You run emacs locally and tramp uses ssh to open the remote files, read the contents into the local emacs buffer and then write the changes back tot he remote file. Helps to have ssh keys setup so you don't have to worry about passwords (but you will need an ssh-agent to make this work easily).
In general, when you find emads does not respond to a key press, especailly if you try C-h k and nothing happens when you hit the key bindings you can't get to work, it is almost certain that something in-between you and emacs is stealing the keys - this is often the window manager or OS, but it can also be due to terminal emulators etc. In over 20 years of using emacs, I've never had emacs 'do nothing' when you hit a key combination - if emacs recieves the key input, it will respond with something, even if that something is to tell you there is no key binding for the keys you pressed. If emacs does absolutely nothing, you know the message just isn't get through!
Open Terminal Preferences
Select Profiles
Keyboard
Check the box for "Use Option as Meta Key"
Good evening,
I have a problem using Emacs in Terminal.app the last 9 hours but wasn't able to solve it on my own.
The workarounds I have found on Stackoverflow etc. didn't persuade me.
I didn't want to use the Option 'Wahltaste als Metataste verwenden' (alt/option as meta), because I have to type for example {}[] with my alt-key. Keybinding of these Charakters in Emacs is no solution for me, because outside of Emacs in nano I want to use []{}..., too.
I also didn't want to use iTerm2.app, I think it should be possible in Terminal too.
Because sometimes I use Emacs over SSH, it is not possible to choose an GUI-based Emacs either.
A possibilty I would accept is to use the left alt/option key for meta and the right one for typing []{}... Or the Fn-Key for meta...
But I wasn't able to do it the last 9 hours...
I already ported 'emulate-mac-keybord-mode.el' from Aquamacs, but I didn't get it work as expected.
Does anybody have an idea?
Thanks in advance,
Zappel
If you insist on a TTY Emacs within Terminal.app, you may probably have some success with kernel level remappings of modifier keys, using KeyRemap4MacBook. I do not know, because I never used it for such things, and since the key codes, Terminal.app sends to the TTY process when a modifier is pressed, are ultimately hard-coded in Terminal.app, this is neither easy nor particularly pretty.
iTerm2 probably provides means to customize modifiers individually, and is generally a superior terminal emulator (with the notable exception of color management), but frankly, do yourself a favor, and use a GUI Emacs.
A GUI Emacs provides a much nicer expierence on OS X. You are not only able to map each modifier key individually with mac-option-modifier and friends, you also more modifiers available, namely Super and Hyper.
For instance, the following setting uses the Command keys as Meta, the function key has Hyper, and keeps the Option keys for OS X, so that you can still use the alternate layout level:
(setq mac-option-modifier 'none
mac-command-modifier 'meta
mac-function-modifier 'hyper)
To edit files on remote systems, you'd just use Tramp then.
I am trying to override Control-Meta-Down Arrow and Control-Meta-Up Arrow in emacs.
I've tried all sorts of combinations of: (global-set-key [C-M-down] 'function) and: "\C-\M-<down>" etc... but it always says: ESC undefined. This means it is only taking into account the M-<down>. Why is it ignoring the Control?? I've been working on this for 3 hours and emacs online documentation with regards to key bindings is surprisingly absolutely terrible.
When using Emacs in the terminal (which you mentioned in a comment), you are limited to the key sequences that the terminal is capable of. Unfortunately, C-down is not one of them...
Some versions of Emacs on Mac OS X have had problems with the qualifier keys. Try to update it to a newer version.
I tested this on an Emacs built from the source archive, and it works as intended. (In this case, it simply says that function is not defined, which is what expected.)
I tried to use Alt as meta key for the FSF Emacs 23 Windows version and for EmacsW32 but especially M-x (Alt-x) does not work.
Somehow I cannot use Alt as Meta key for Alt-x (M-x). I searched really hard and all I got is how to switch the meta key to Alt in w32-meta-style. Currently this variable has the value 'use Alt as Meta key'. I also tried all other values with no success. Furthermore I installed the unpatched version of emacs from http://ourcomments.org/Emacs/EmacsW32.html and the original binaries from gnu.org. All versions have the same problem.
Alt works as Meta, except for Alt-x (Meta-x).
My setup is as follows:
Windows 7 x64 Professional
German keyboard
This question is Windows specific as I have a working Ubuntu version of Emacs 23.
EDIT: It was Growl for Windows. It loads on start up and caputes all Alt-x inputs. So my solution was to just disable Growl as I do not need it anymore. Might be another App for you.
It should work out of the box. Does Alt+x work as M-x if you start Emacs with the -Q flag? That inhibits loading of your customizations, in case one of them is breaking M-x on Windows.
Also, Emacs only treats the left Alt key as Meta by default, the right Alt (AltGr), is used for entering special characters .
I don't know about w32-meta-style but did you set w32-alt-is-meta? See http://www.gnu.org/software/libtool/manual/emacs/Windows-Keyboard.html
The Growl hotkeys can be changed:
https://groups.google.com/forum/#!topic/growl-for-windows/luSpf9lQQRM
To disable the hotkeys, just remove the content of the 'value' tags.
I'm trying to use the new iTerm app on my Snow Leopard Mac, but my Ctrl seems to be completely dead (as in non-responsive, as in nothing happens when I type Ctrl+a except for an outputed 'a') and I haven't found anything useful while googling. The closest match was this thread here on stackoverflow, but everything in Terminal.app works as it should.
And, even more strange - I can Ctrl+z myself out of applications, but I can't save files in Emacs (C-x C-s) or any other keyboard shortcuts that uses a Ctrl shortcut. And it's not local, since Ctrl is as broken on my iMac as it is on other unix computers I've sshed onto with iTerm. I've tried both in bash and zsh.
I've tried to remove all files concerning iTerm.app in my ~/Library/Application Support, and I've tried the very latest version (currently 13 h old) of iTerm I could lay my hands on, but to no avail.
Any ideas?
This seems to be an iTerm bug.
You can work around it by creating a key mapping in the profile settings.
Add a mapping for ^x so it sends 0x18 (which is the encoded form of ctrl+x).
I suggest to check this post to see if the ctrl key is enabled in your preferences
https://apple.stackexchange.com/questions/52041/how-to-press-control-key-on-mac
Did you try to configure key bindings for this terminal emulator as specified in the iTerm wiki:
http://code.google.com/p/iterm2/wiki/Keybindings
at last, have you try set -o emacs or set -o vi?
If it works, set it in your ~/.bashrc to run it at login.