diff options
-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) |