From 430dc72b033523b18256595bb6262cbd5bd78a6c Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Tue, 24 Dec 2019 19:54:24 +0900 Subject: [PATCH] Add my-imenu-list-toggle --- emacs.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index a4cca35..0349836 100644 --- a/emacs.el +++ b/emacs.el @@ -1230,10 +1230,19 @@ found, otherwise returns nil." 'ggtags-mode) ) -(when (autoload-eval-lazily 'imenu-list) +(when (fboundp 'imenu-list-minor-mode) + (defvar imenu-list-buffer-name) + (defun my-imenu-list-toggle () + "My 'imenu-list` toggle." + (interactive) + (require 'imenu-list) + (if (eq (window-buffer) + (get-buffer imenu-list-buffer-name)) + (imenu-list-minor-mode -1) + (imenu-list-minor-mode 1))) ;; (set-variable 'imenu-list-auto-resize t) (set-variable 'imenu-list-focus-after-activation t) - (define-key ctl-x-map (kbd "C-l") 'imenu-list-smart-toggle)) + (define-key ctl-x-map (kbd "C-l") 'my-imenu-list-toggle)) (add-hook 'emacs-lisp-mode-hook (lambda ()