(symbol-type '(symbol-type symbol-type-definition))
(function '(defun function macro special-form major-mode)))))
(require 'project)
- (dolist-with-progress-reporter
- (file
- (seq-filter
- (lambda (file) (string= (file-name-extension file) "el"))
- (project-files (project-current))))
+ (dolist-with-progress-reporter (file (elisp-project-files))
"Scanning for references"
(let (all lla)
(pcase-dolist (`(,type ,beg ,len . ,_) (gethash identifier (elisp-sym-name-index file)))
(symbol-type '(symbol-type symbol-type-definition))
(function '(defun function macro special-form major-mode)))))
(require 'project)
- (dolist-with-progress-reporter
- (file
- (seq-filter
- (lambda (file) (string= (file-name-extension file) "el"))
- (project-files (project-current))))
- "Scanning for references"
+ (dolist-with-progress-reporter (file (elisp-project-files)) "Scanning for references"
(let (hits)
(pcase-dolist (`(,type ,beg ,len . ,_) (gethash str (elisp-sym-name-index file)))
(when (or (null types) (memq type types))
(when hits (push (cons file hits) res))))
(nreverse res)))
+(defun elisp-project-files ()
+ (seq-filter
+ (lambda (file)
+ (and (string= (file-name-extension file) "el")
+ (not (string-prefix-p ".#" (file-name-base file)))))
+ (project-files (project-current))))
+
(defun elisp-make-xref (beg len)
(let* ((beg-end (save-excursion
(goto-char beg)
(defvar elisp-sym-name-index-cache (make-hash-table :test #'equal))
+(defconst elisp--dummy-hash-table (make-hash-table :test #'equal))
+
(defun elisp-sym-name-index (file)
(if-let ((buf (get-file-buffer file))
((buffer-modified-p buf)))
(with-current-buffer buf (elisp-sym-name-index-1 file))
(let ((cached (gethash file elisp-sym-name-index-cache))
(modtime (file-attribute-modification-time (file-attributes file))))
- (cdr
- (if (time-less-p (or (car cached) 0) modtime)
- (puthash file (cons modtime
- (with-work-buffer
- (setq lexical-binding t)
- (insert-file-contents file)
- (elisp-sym-name-index-1 file)))
- elisp-sym-name-index-cache)
- cached)))))
+ (if modtime
+ (cdr
+ (if (time-less-p (or (car cached) 0) modtime)
+ (puthash file (cons modtime
+ (with-work-buffer
+ (setq lexical-binding t)
+ (insert-file-contents file)
+ (elisp-sym-name-index-1 file)))
+ elisp-sym-name-index-cache)
+ cached))
+ ;; File does not exists.
+ elisp--dummy-hash-table))))
(defun elisp-sym-name-index-1 (source)
(let ((all (make-hash-table :test #'equal))