Limited the errors from imenu in prog modes
While I had 'simply' addressed the issue that Charles Choi just mentioned, I thought I would use his better implementation.
This commit is contained in:
parent
f0bd926f2c
commit
222d904d3e
1 changed files with 8 additions and 4 deletions
|
|
@ -164,16 +164,20 @@ I’ve often called =imenu= to easily jump to a function definition in a file (o
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun ha-imenu-setup ()
|
(defun ha-imenu-setup ()
|
||||||
"Set up the imenu customization. Use in hooks."
|
"Set up the imenu customization. Use in hooks."
|
||||||
(ignore-errors
|
(condition-case err
|
||||||
(imenu-add-menubar-index)
|
(imenu-add-menubar-index)
|
||||||
(setq-local imenu-auto-rescan t)
|
(setq-local imenu-auto-rescan t)
|
||||||
(when (derived-mode-p 'prog-mode)
|
(when (derived-mode-p 'prog-mode)
|
||||||
(setq-local imenu-sort-function 'imenu--sort-by-name))))
|
(setq-local imenu-sort-function 'imenu--sort-by-name))
|
||||||
|
|
||||||
|
(imenu-unavailable
|
||||||
|
(let ((inhibit-message t))
|
||||||
|
(message "Warning: %s" (error-message-string err))))))
|
||||||
|
|
||||||
(add-hook 'org-mode-hook 'ha-imenu-setup)
|
(add-hook 'org-mode-hook 'ha-imenu-setup)
|
||||||
(add-hook 'markdown-mode-hook 'ha-imenu-setup)
|
(add-hook 'markdown-mode-hook 'ha-imenu-setup)
|
||||||
(add-hook 'prog-mode-hook 'ha-imenu-setup)
|
|
||||||
(add-hook 'makefile-mode-hook 'ha-imenu-setup)
|
(add-hook 'makefile-mode-hook 'ha-imenu-setup)
|
||||||
|
(add-hook 'prog-mode-hook 'ha-imenu-setup)
|
||||||
#+end_src
|
#+end_src
|
||||||
** File Access
|
** File Access
|
||||||
*** Remote Files
|
*** Remote Files
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue