3

I am trying to rebind some keys for info-mode without success. I am not sure whether I am missing something, or whether a special hook is required. I am using the following hook in my init.el:

(add-hook 'info-mode-hook
          (lambda ()
            (message "setting up info-mode")
            (local-set-key (kbd "C-c l")
                           'info-last)
            (local-set-key (kbd "g g")
                           'evil-goto-first-line)
            (local-set-key (kbd "C-c g")
                           'info-goto-node)
            )
 )

But when I run C-h i to open info-mode, my custom bound keys above do not work and I do not get any message like "setting up info-modein myMessages` buffer.

I have evaluated the above hook with an empty emacs config (emacs -q), and I have many other mode hooks that are working fine.

Any suggestions to help troubleshoot or resolve this issue would be appreciated! I am happy to clarify anything as well.

  • 2
    Try using a capital "I" for "Info-mode . . . " -- e.g., Info-mode; Info-mode-hook. It's unfortunate that the author decided to break from tradition with lowercase letters, but that's how it goes sometimes. To see more, type: M-x find-library RET info RET Some of the variables/functions are lowercase -- it's a hodge-podge mess if you ask me. – lawlist Dec 16 '15 at 7:32
  • Yep, that works! If you add your comment as an answer, I will happily accept it :D – modulitos Dec 16 '15 at 7:52
  • Take note that C-h v major-mode would tell you Info-mode, and that mode hooks are always the mode name with a -hook suffix. – phils Dec 16 '15 at 10:36
6

The built-in Info-mode uses a combination of initial uppercase and/or all lowercase letters for the various variables/functions/faces. There may be a rhyme or reason, but it quite frankly escapes me as I read through the source-code. I wish there were a better method than familiarizing ourselves with the source code by typing M-x find-library RET info RET and reading through it with some targeted word searches, but I don't really have a better method -- except perhaps find-variable/find-function/find-face and trying both info- with a lowercase and Info- with an uppercase.

In the context of this particular question, the major-mode is Info-mode with a capital letter "I" and the hook is similar -- i.e., Info-mode-hook with a capital "I".

  • Thanks! Hopefully someone in the future will find this very helpful. – modulitos Dec 16 '15 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.