What is the keybind in help-mode to go into link? - emacs

There are always links in help-mode which suppose to be entered by the <return> button. Since I remapped the <return> button to indent-and-new-line, I can no longer enter the link. I would like to find the correct key map for the enter button.
Help mode defined in `help-mode.el' (`help-mode'):
Major mode for viewing help text and navigating references in it.
Entry to this mode runs the normal hook `help-mode-hook'.
Commands:
key binding
--- -------
C-c Prefix Command
TAB forward-button
(that binding is currently shadowed by another mode)
RET help-follow
(that binding is currently shadowed by another mode)
ESC Prefix Command
SPC scroll-up-command
I get this help from the describe mode. I tried the help-follow but it does not work. What should be the correct key bind?

By default RET runs push-button when on a link in help-mode. You should also be able to click on links with your primary mouse button if you like using the rodent. This function is not bound to any other keys out of the box.
I'm not sure how you're rebinding RET, but it probably makes sense to do it a bit more selectively. indent-and-new-line might make sense in most modes, but as you have discovered there are situations where you may want the default behaviour.
Perhaps you could do this via prog-mode-hook, so it only affects programming modes?
Alternatively you could bind some other key to push-button in help-mode.
By the way, here is a useful technique that would have let you discover this keybinding yourself:
Run Emacs with the -Q flag to suppress loading of your init file and the system init file.
Activate a buffer that uses help-mode, e.g. by using C-h f message RET to see the documentation for the message function and then C-x o to switch to the help window.
Press C-h k RET to see what function is bound to RET.

Related

How to enable Arrow-Up (and Arrow-Down) key to show previous (or next) entered line in Emacs?

How to enable Arrow-Up (and Arrow-Down) key to show previous (or next) entered line in Emacs?
In Emacs, particular in Scheme mode, I want to use the ArrowUp and ArrowDown keys to navigate in the history or entered commmands, like I use to do in Bash.
However, pressing these keys in the Scheme interpreter (running inside Emacs) doesn't do anything except to go up or down one line in the buffer.
I guess the way to enable this history navigation applies to all modes?
I want to go the expression above i.e. '(1 2 3).
How do I enable it?
You need to get into the command buffer to get history of commands. Press M-x and then try Up /Down. When you are in a regular buffer, these are indeed navigation keys.
Also. have a look at Helm.
Edit (to sync the answer with the updated question, pulling the updated answer from the comments)
If the intention is to use history in the Lisp interpreter buffer, then C-up and C-down are the usual key bindings for that.

Some shortcuts don't work on emacs beginning with C-c

In Haskell-mode, the shortcut C-c C-= is defined to do something.
Trying this shortcut, I realized that emacs do not recognize the shortcut C-c C-=.
Indeed, when I try the shortcut on emacs, the buffer write C-c = is not defined although I pressed C- C-=. I have the same problem with some other symbols like '.' or 'ยง'. But shortcuts like C-c C-l or C-c C-c work.
I try to remove my .emacs but I have the same problem.
a friend have the same problem as me.
Both we are on ArchLinux (64 bits) and we use emacs in console. The keyboard is an azerty.
The problem come from emacs ? Arch Linux ?
Your terminal can't send Emacs C-= so you can't use that key sequence. (Emacs would recognise it if it received it, but that won't happen.)
Your options are:
Run GUI Emacs.
Use M-x name-of-command RET (for whatever command is bound to the key sequence you're not able to use). Use C-hm to see the major mode's bindings, or C-hb to see all current bindings, in order to learn what those command names are.
Create new custom keybindings for the commands in question (i.e. bindings which your terminal can send to Emacs).
Find a different terminal emulator with enhanced key sequence abilities. The vast majority of them will be no better than what you have, because they're all adhering to the limitations of the terminals they're emulating. The most capable one I know of is http://invisible-island.net/xterm/xterm.html but you may need to compile it yourself, and then expect to spend lots of time configuring it. (It's not a trivial solution, though, and xterm requires a GUI environment, so running GUI Emacs is much simpler.)
Use C-x#c<key> instead of C-<key>.
With that last option, you can use a sequence your terminal can send to fake a sequence that it can't send.
C-cC-= would become C-cC-x#c=
If you really wanted to use that last option, you can set a custom binding to simplify the sequence (may be necessary in some instances to avoid conflicting with existing sequences). See the end of https://stackoverflow.com/a/24804434/324105 for more information.
To add to phils' post - another option is an Emacs package (which I wrote), which can teach Emacs and terminals how to properly recognize all PC keyboard keys and modifier key combinations:
https://github.com/CyberShadow/term-keys
The default configuration already includes encoding key combinations like Ctrl=, as well as similar variations.

C-<SPC> is intercepted in emacs -nw (terminal intercept?)

I use urxvt (terminal) under awesome (window manager) and ubuntu (os).
In graphical mode, c- set the mark but in text mode it inserts a space.
The problem is solved when using gnome-terminal but some other key combinations still does not work. For instance, C-: insert a : in both terminals.
I do not know where to look at to correct this behaviour.
C-h k (help on key combination) followed by one of these combination shows only the key pressed along ctrl, for instance C- is interpreted as .
As stated in comments, the terminal is probably the cause. I believe that C- should not enter a space at the terminal prompt, which it does here.
I identified this question as being related. This one too.
In my case, Ctrl-Space was being used to change input methods. Running ibus-setup and unbinding it fixed my problem (it now produces Nul)
See also: https://askubuntu.com/questions/243639/ctrlspace-has-been-bound-to-invoke-some-input-method-and-does-not-work-in-ema

User super key for meta commands in emacs

I'm trying to learn emacs and would like to use the super key on my keyboard for any meta commands in emacs, because I use dwm as my window manager and it uses the meta key extensively. I have read this page, using it to try
(setq x-meta-keysym 'super)
(setq x-super-keysym 'meta)
with no luck. Ideally I'd like to simply flip them, but only in emacs. when I inspect the variables x-meta-keysym and x-super-keysym with C-h v the commands do seem to be evaluated correctly. When I check the super key with the linux utility xev it confirms that the key I'm pressing is mapped to Super_L.
I agree with #Tyler
In my case I use dwm as window manager, so meta (ALT) key is used to control almost all its features. When using emacs, meta key conflicts with some key bindings, eg: when I'm moving around words M-f or Mb (that's why I came to this thread ;)), so I found three choices to get rid with this issue:
1) change emacs key binding and use super key as meta key
(setq x-meta-keysym 'super
x-super-keysym 'meta)
Both symbols (variables) are required, because if you just use only x-super-keysym 'meta, it enables both keys as meta key. If you just use only x-meta-keysym 'super, it disables both and de command buffer will return s-x is undefined.
2) change dwm key binding for meta to super key in config.h file. take a look in http://dwm.suckless.org/customisation/windows_key
/* key definitions */
-#define MODKEY Mod1Mask /* meta (ALT) key */
+#define MODKEY Mod4Mask /* super (windows or cmd) key */
3) override xmodmap keymap bindings swapping mod1 to super and mod4 to meta (be sure to check what xmodmap returns at first glance, and not affect keybindings of other programs)
Finally, I recommend not to change default emacs meta key because is less comfortable to your fingers and may cause you to respond slowly to keystrokes. Try options 2 or 3 depending your environment.
So, it turns out that the above commands work when emacs is not used in terminal mode. I had been trying it in the terminal exclusively which is why it wasn't working. I'm not sure how to fix it in the terminal, but it's good enough I suppose.
edit: it was the terminal emulator that was gobbling the keypresses before they got to emacs, so the original commands do work, so long as the keypress actually makes it to emacs.

Emacs C-c } command and parentheses-match checking

I am working in Emacs 23, editing LaTeX via AUCTeX. I noticed in emacs that when I press C-c }, I receive the minibuffer message
Scan error: "Unbalanced parentheses", 16026, 16440
Question 1. What exactly is this command doing?
Question(s) 2. More generally, how can I determine what I a given macro is doing? Is there, for example, a universal command that request the keyboard shortcut as an input and outputs a description of the command to which that shortcut is bound? Is there a list of all active keyboard shortcuts?
Question 3. How can I find my unmatched parentheses? The post here recommends the command M-x check-parens, but it availed me nothing, not even a minibuffer message.
The answer to 1 and 2 is to do C-h k C-c } and see what the help buffer tells you. This is one of the features that allows us to call Emacs a self-documenting editor. Don't forget that you can follow the links in the help buffer to both the source code where this function is implemented and to other documentation.
You may also want to use C-h m to see all the key bindings added by the major and minor modes that are currently enabled and C-h ? to see what other interesting help functions there are.
I've never used check-parens specifically, but it does work in my current buffer, which is javascript. I see from its documentation (C-h f check-parens) that it relies on the current syntax table, so perhaps for TeX the syntax table doesn't contain enough information for check-syntax to find the error.