I found out when I use gud-gdb, it overrides one of my keybindings. I would like to check which mode changed the keybinding (I know it's probably gud-gdb, but I would still like to know how to check this). I know about C-h k, but is it possible to check which mode set a keybinding?
I use C-h+m, which runs describe-mode. That lists all the keybinds associated with each mode that is currently active. The keybinding that is getting clobbered will likely be there.
In general, when assigning keys (either as a user or as a mode author) it's best to follow the Emacs key binding conventions.
Related
I have a lot of custom keybindings when attaching my non-English Windows-Keyboard to my English Mac.
When working directly with the Mac, I have to disable some of the bindings by commenting out a big section in the keybindings.json.
How can I automate this settings switch?
I know that keybindings use a when clause, but I did not find a way to check which keyboard is active or if I am on battery or not, or any other difference in the two setups.
You can use the extension Extra Context.
You can set (or toggle) a context variable to select a bunch of keybindings.
You can use multi-command to combine several set-on set-off for variables to select a particular keyboard.
I'm wondering if I'm the only one struggling (i.e. failing) to keep the emacs key bindings working in Eclipse.
I set them. It works fine. The it stops working fine. Some keys still work, others don't. I find myself in a kind of weird quantum state of uncertain key-binding setup superposition. Some key bindings from the standard set work, some from the emacs set work, some things I can achieve with neither set of bindings.
I'm the only one to experience this? I've seen this on at least 4 computers in the past few months.
I set key bindings back to standard set. Sometimes it works. I use the reset to defaults button. Try to set it back to emacs. Doesn't work. Pressing the apply button between the different steps or not... Drives me crazy.
On some computers, the bindings are just whatever. Can only save using the mouse, C-d and C-k don't work to delete/cut lines, most emacs keys still work but back to C-space for auto-completion, etc.
Anyone knows what can cause this? How to prevent it? Am I pressing some key binding key-bindings by mistake?
I had a similar problem with the Ctl-K, Ctl-D commands: after doing an upgrade (I forget whether it was Eclipse itself or the Android plugin) I saw Eclipse offering a little pop up menu on both these keys, offering to do either the correct Emacs command or some completely unrelated command. So, for example, Ctl-D offered to either delete the next character (correct) or delete the line (incorrect).
After some poking around in the key bindings (Windows>Preferences>General>Keys), I discovered that sure enough, someons in the Eclipse project supplied these wrong bindings in addition to the correct ones. So I deleted the incorrect bindings and left the correct ones.
So I thought I would be out of the woods at this point. But I also discovered that I had to add the correct binding back in a couple of times before it would stick.
Look for Cut to End of Line under the Command column and make sure it has Ctl-K when Editing Text and in the Text Editing Category. The same for Delete Next (which means next character). But make sure Ctl-D does NOT show up for the Delete Line Command.
Test it out in an editor window; if it fails, go edit the bindings again, test again, repeat until it sticks, making sure you click Apply after editing the bindings.
Looking a the different methods for completion in CEDET semantic (fresh version from the Bazaar repository), I see I have the following options (keyboard bindings as suggested by Alex Ott in his config file)
C-c ? (semantic-ia-complete-symbol)
C-return (semantic-ia-complete-symbol-menu)
C-c , l (semantic-analyze-possible-completions)
However, none of them seem to give me the option to choose between the possible completions conveniently using the keyboard.
For example, (semantic-ia-complete-symbol-menu) opens a menu where I can choose between the different options, but as far as I can tell it requires me to use the mouse (I tried C-n, C-p, M-n, M-p to navigate the menu with no success).
On the other hand (semantic-ia-complete-symbol) opens another buffer with the options. I can also use the mouse to choose the desired autocompletion, but I would like to use the keyboard instead.
Also, in previous versions of CEDET, there was a variable (semantic-complete-inline-analyzer-displayor-class) that allowed me to choose between several options for autocompletion (e.g. (semantic-displayor-ghost), or a more elegant overlay as a tooltip), but this variable does not seem to exist anymore.
In case it matters, I work mostly with C++ files.
Update:
The only method that seems to allow me to cycle through autocompletions is C-c , space (semantic-complete-analyze-inline), where I can use TAB to autocomplete, but it doesn't show a menu of possible autocompletions that I can choose from.
In new versions of CEDET it's recommended to use auto-complete or similar packages. You can add ac-semantic to ac-sources, and then auto-complete will use Semantic as source of data for completions. The new version of Emacs/CEDET articles, mentions this setup & shows necessary code. Please try it
How do I customize which window GUD will use when i issue commands - 'up', 'down', etc ? It seems to use an arbitrary window, sometimes even the window with gdb in it - I want to be able to specify a specific window to be used.
Have you considered borrowing the key bindings mentioned in the following question?
Emacs, switch to previous window
This question implies that GUD steps on some things if you don't add a parameter. Maybe your command bindings are being affected similiarly.
Using gdb in Emacs 23
I asked a buddy of mine about this issue and here is what he said.
Well, we used xemacs and so it's not exactly apples to apples here. I
do have gnu-emacs installed on cygwin and I can't replicate his
problem. I think he definitely needs to list a version # for emacs
and the version # for all his installed packages.
When you press up/down it calls 'previous-line' and 'next-line'
respectively which both move the cursor in the default buffer. The
only thing I can think is that he has something running that switches
buffers (lisp 'set-buffer') temporarily and maybe doesn't set it back
or errors b/f restoring the buffer? Better to use
'with-current-buffer' (or one of the other with-* forms) that saves
the current state of the ui runs your lisp code and restores the ui
state.
I've just started to put in the time to get to learn emacs. By default my meta key is bound to Esc, and I'm finding that really inconvenient. I read somewhere however that it's not a good idea to change the binding to Alt. Is that true? If not, how could I go about doing that?
It's bound to Alt by default for me, and I have no problems with that. Are you on a Mac perhaps? There it is bound to one of the other keys like option.
If you are on a mac, the way to change the key will probably vary based on which version of Emacs you're using--e.g., I think changing it in the terminal would be different than changing it on one of the windowed varieties.
Another thing to try: http://www.jwz.org/xkeycaps/
Look through the keyboard layout with this and see if any key is assigned to Meta. If not, try assigning it; otherwise try changing it. I haven't actually tried this, but it looks promising.
If you are using a Mac, you can follow the directions from here:
"If you do not want to use the Esc key, you can specify a key to use as Meta. To specify a Meta key, select the Emulation tab of the Editor Preferences dialog."
You can then select to use Alt or Command as your Meta key.
I'm guessing that you're on Mac, because I had the same problem. This is how I fixed it:
Open Terminal
Open up the preferences
Open up the "Profiles" tab and choose the "Keyboard" tab with your current profile selected
Below the long scroll box are a couple check boxes. Check "Use Option as Meta key."
I'm using OS X 10.11.5, so I don't know about older versions of Terminal. I imagine that it would be similar.
For me, on my mac, it was bound to Alt by default, but I found it anoying because Alt is used for some special characters on Mac.
I added these lines on my .emacs
(setq mac-function-modifier 'meta)
(setq mac-option-modifier nil)
Thus in your case, you would have to add this in your .emacs (I tried this solution, and it worked for me)
(setq mac-option-modifier 'meta) ; set alt-key to meta
(setq mac-escape-modifier nil) ; set esc-key to nil
I had to do this for emacs while remotely connected to my raspberry pi.
Go to terminal.
type:
xmodmap -e "keysym Alt_L = Meta_L Alt_L"
This was suggested in xmodmap's manual
man xmodmap
Hope that helps :) I'm pretty new to this though so someone else may want to comment.