#'elisp-flymake-byte-compile nil t)
(add-hook 'refactor-backend-functions #'elisp-refactor-backend nil t)
(add-hook 'context-menu-functions #'elisp-context-menu 10 t)
- (setq-local imenu-create-index-function #'elisp-create-index)
+ (setq-local imenu-create-index-function #'elisp-create-imenu-index)
(alist-set "compf" prettify-symbols-alist ?∘ #'equal))
;; Font-locking support.
(let ((bounds (bounds-of-thing-at-point 'symbol)))
(delete-region (car bounds) (cdr bounds))))
+(defun elisp-create-imenu-index ()
+ (goto-char (point-min))
+ (let (index)
+ (condition-case nil
+ (while t
+ (scope (lambda (type beg len &rest _)
+ (cl-case type
+ ((defun)
+ (push (cons (buffer-substring-no-properties beg (+ beg len)) beg)
+ (alist-get "Function" index nil nil #'string=)))
+ ((defvar)
+ (push (cons (buffer-substring-no-properties beg (+ beg len)) beg)
+ (alist-get "Var" index nil nil #'string=)))
+ ((defface)
+ (push (cons (buffer-substring-no-properties beg (+ beg len)) beg)
+ (alist-get "Face" index nil nil #'string=)))))))
+ (end-of-file
+ (dolist (group index) (setcdr group (nreverse (cdr group))))
+ index))))
\f
(put 'read-symbol-shorthands 'safe-local-variable #'consp)