1

Nowadays I often insert @Online entries into my bibliography files.

Unfortunately, the RefTeX doesn't have the Online-Entry bound to any key by default.

I tried to add something like

;; I often use the "@Online" entry in my bibliographies.
;; Unfortunately, no key binding was defined by default.  I think C-c
;; C-e C-o would be a good choice and is still unused.
(define-key reftex-mode-map (kbd "C-c C-e C-O") 'bibtex-Online)

Running eval-last-sexp (bound to C-xC-e) gave no error, but said bibtex-Online as expected.

What is my mistake?

EDIT

After having Emacs restarted, the key binding worked, but unfortunately (again!) not in a buffer with a bibliography file! I was working on my LaTeX file and when I tried to insert a new environment by pressing C-cC-e, but instead of asking which environment I was about to insert, Emacs waited for the next keypress an ah voilà, after completing the session with C-o Emacs most happily inserted an template for an Online document (@Online{...}) into my LaTeX buffer. Yet, still, the key binding didn't work in the bibliography buffer :-(

5
  • Reg. your sentence: I think C-c C-e C-o would be a good choice and is still unused. From Emacs lisp manual: Don't define C-c letter as a key in Lisp programs. Sequences consisting of C-c and a letter (either upper or lower case) are reserved for users; they are the only sequences reserved for users, so do not block them. Dec 7, 2019 at 21:48
  • @ArashEsbati I consider myself a user, but your hint doesn't apply.. Quoting from your quote: "C-c and a letter (either upper or lower case)" would match e.g. C-c o or C-c O. But I used C-c C-e C-o, which shouldn't match? At least, I choose it, as all of the bibliography entries are starting with C-c C-e as a prefix. So i guess, it can't be that false?
    – Jan
    Dec 8, 2019 at 11:22
  • My hint was meant to say: Stay in the user realms with keybindings. Or approach bibtex maintainer to possibly add your binding to the mode. Dec 8, 2019 at 12:24
  • @ArashEsbati thank you. C-c o and C-c O are already defined by me (and even more important) well trained to me. I understand your hint, that my personal keybinding could rise a conflict, if the bibtex-mode-maintainer decide, to add exact this keybinding to their package?
    – Jan
    Dec 8, 2019 at 12:30
  • I was more thinking about C-c C-e C-o and not C-c [oO] :-) Dec 8, 2019 at 12:32

1 Answer 1

1

Hurray. I found my mistake.

Instead of

(define-key reftex-mode-map (kbd "C-c C-e C-O") 'bibtex-Online)

one has to write

(define-key bibtex-mode-map (kbd "C-c C-e C-O") 'bibtex-Online)

You have to use bibtex-mode-map, not its brother reftex-mode-map.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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