From 72287d6dc7d7319cc401aa605526ca1ba4dc4886 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 21 Mar 2014 01:46:00 -0400 Subject: Define keymap for Bog Instead of just suggesting keys, create a keymap, but don't bind it to a prefix key. --- README.md | 20 +++++++------------- bog-readme.org | 16 +++++----------- bog.el | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f304b7e..916b71d 100644 --- a/README.md +++ b/README.md @@ -110,16 +110,10 @@ The variables below are important for specifying how Bog behaves. a directory of single-entry BibTeX files or a single BibTeX file is used. -# Recommended keybindings - -Bog doesn't claim any keybindings, but using "C-c b" as a prefix while -in Org mode is a good option. - - (define-prefix-command 'bog-map) - (define-key org-mode-map (kbd "C-c b") 'bog-map) - (define-key bog-map "p" 'bog-find-citekey-pdf) - (define-key bog-map "r" 'bog-rename-staged-pdf-to-citekey) - (define-key bog-map "b" 'bog-find-citekey-bib) - (define-key bog-map "h" 'bog-goto-citekey-heading-in-buffer) - (define-key bog-map "H" 'bog-goto-citekey-heading-in-notes) - (define-key bog-map "w" 'bog-search-citekey-on-web) \ No newline at end of file +# Keybindings + +A keymap is defined for Bog, but a prefix isn't claimed. The code below +shows how to use "C-c b" as the prefix while in Org mode. + + (eval-after-load 'org + '(define-key org-mode-map (kbd "C-c b") bog-mode-map)) \ No newline at end of file diff --git a/bog-readme.org b/bog-readme.org index b79f0fd..9e18fd3 100644 --- a/bog-readme.org +++ b/bog-readme.org @@ -118,18 +118,12 @@ The variables below are important for specifying how Bog behaves. a directory of single-entry BibTeX files or a single BibTeX file is used. -* Recommended keybindings +* Keybindings -Bog doesn't claim any keybindings, but using "C-c b" as a prefix while -in Org mode is a good option. +A keymap is defined for Bog, but a prefix isn't claimed. The code below +shows how to use "C-c b" as the prefix while in Org mode. #+begin_src emacs-lisp - (define-prefix-command 'bog-map) - (define-key org-mode-map (kbd "C-c b") 'bog-map) - (define-key bog-map "p" 'bog-find-citekey-pdf) - (define-key bog-map "r" 'bog-rename-staged-pdf-to-citekey) - (define-key bog-map "b" 'bog-find-citekey-bib) - (define-key bog-map "h" 'bog-goto-citekey-heading-in-buffer) - (define-key bog-map "H" 'bog-goto-citekey-heading-in-notes) - (define-key bog-map "w" 'bog-search-citekey-on-web) + (eval-after-load 'org + '(define-key org-mode-map (kbd "C-c b") bog-mode-map)) #+end_src diff --git a/bog.el b/bog.el index 22bdedd..99694c3 100644 --- a/bog.el +++ b/bog.el @@ -545,6 +545,20 @@ level `bog-refile-maxlevel' are considered." (font-lock-add-keywords 'org-mode '((bog-non-heading-citekey-p . 'bog-citekey-face))) + +;;; Keymap + +(defvar bog-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "p" 'bog-find-citekey-pdf) + (define-key map "r" 'bog-rename-staged-pdf-to-citekey) + (define-key map "b" 'bog-find-citekey-bib) + (define-key map "h" 'bog-goto-citekey-heading-in-buffer) + (define-key map "H" 'bog-goto-citekey-heading-in-notes) + (define-key map "w" 'bog-search-citekey-on-web) + map) + "Keymap for Bog.") + (provide 'bog) ;; bog.el ends here -- cgit v1.2.3