diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-11-29 01:40:29 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-11-29 01:40:29 -0500 |
commit | dc1fb5b94cf89f6cc3fc903e2caa1a42a83aa216 (patch) | |
tree | 522fc79c3b4bb4e8505fc14241151649f9351fee | |
parent | 18c1bbf68271e297351a718ce0d5c55b30d7305c (diff) | |
download | emacs.d-dc1fb5b94cf89f6cc3fc903e2caa1a42a83aa216.tar.gz |
Wrap imenu to add rescan as prefix argument
-rw-r--r-- | lisp/init-general.el | 12 | ||||
-rw-r--r-- | lisp/init-view.el | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lisp/init-general.el b/lisp/init-general.el index 5f3876c..eb82345 100644 --- a/lisp/init-general.el +++ b/lisp/init-general.el @@ -54,7 +54,17 @@ (global-unset-key (kbd "M-{")) (global-set-key (kbd "M-[") 'backward-paragraph) -(global-set-key (kbd "C-c j") 'imenu) + +(defun km/imenu (rescan) + "Call `imenu', rescanning if RESCAN is non-nil" + (interactive "P") + (when rescan + ;; Taken from `imenu-choose-buffer-index'. + (imenu--cleanup) + (setq imenu--index-alist nil)) + (call-interactively #'imenu)) + +(global-set-key (kbd "C-c j") 'km/imenu) ;; Taken from ;; http://milkbox.net/note/single-file-master-emacs-configuration/. diff --git a/lisp/init-view.el b/lisp/init-view.el index e76cefa..c849183 100644 --- a/lisp/init-view.el +++ b/lisp/init-view.el @@ -9,6 +9,6 @@ (define-key view-mode-map "b" 'backward-word) (define-key view-mode-map "]" 'forward-paragraph) (define-key view-mode-map "[" 'backward-paragraph) - (define-key view-mode-map "j" 'imenu)) + (define-key view-mode-map "j" 'km/imenu)) (provide 'init-view) |