(defvar find-symbol-type-regexp
(concat "^\\s-*(scope-define-symbol-type" find-function-space-re "%s\\(\\s-\\|$\\)"))
+(defvar find-icon-regexp
+ (concat "^\\s-*(define-icon" find-function-space-re "%s\\(\\s-\\|$\\)"))
+
(defvar find-widget-regexp
(concat "^\\s-*(define-widget" find-function-space-re "%s\\(\\s-\\|$\\)"))
(ert-deftest . find-ert-deftest-regexp)
(define-widget . find-widget-regexp)
(define-error . find-error-regexp)
+ (define-icon . find-icon-regexp)
(define-symbol-type . find-symbol-type-regexp))
"Alist mapping definition types into regexp variables.
Each regexp variable's value should actually be a format string
(defun icons--register (name parent spec doc keywords)
(put name 'icon--properties (list parent spec doc keywords))
+ (add-to-list 'current-load-list `(define-icon . ,name))
(custom-add-to-group
(or (plist-get keywords :group)
(custom-current-group))
(defun describe-icon (icon)
"Pop to a buffer to describe ICON."
(interactive
- (list (intern (completing-read "Describe icon: " obarray 'iconp t))))
+ (list (intern (completing-read "Describe icon: " obarray #'iconp t))))
(let ((icon (if (stringp icon) (intern icon) icon))
(help-buffer-under-preparation t))
(help-setup-xref (list #'describe-icon icon)
:help (lambda (beg _end def)
(if (equal beg def) "Block definition" "Block")))
+(scope-define-symbol-type icon ()
+ :doc "Icon names."
+ :face 'font-lock-type-face
+ :help (constantly "Icon")
+ :completion (constantly (lambda (sym) (get sym 'icon--properties)))
+ :namespace 'icon)
+
+(scope-define-symbol-type deficon ()
+ :doc "Icon definitions."
+ :face 'font-lock-type-face
+ :help (constantly "Icon definition")
+ :imenu "Icon"
+ :namespace 'icon)
+
(defvar scope-counter nil)
(defvar scope-local-functions nil)
(scope-define-function-analyzer scope-report (type &rest _)
(when-let ((q (scope--unqoute type))) (scope-report-s q 'symbol-type)))
-(scope-define-function-analyzer scope-report-s (_sym type)
+(scope-define-function-analyzer scope-report-s (&optional _sym type)
(when-let ((q (scope--unqoute type))) (scope-report-s q 'symbol-type)))
+(scope-define-function-analyzer icons--register (&optional name parent _spec _doc kws)
+ (when-let ((q (scope--unqoute name))) (scope-report-s q 'deficon))
+ (when-let ((q (scope--unqoute parent))) (scope-report-s q 'icon))
+ (when-let ((q (scope--unqoute kws)))
+ (while-let ((kw (car-safe q))
+ (bkw (scope-sym-bare kw))
+ ((keywordp bkw)))
+ (scope-report-s kw 'constant)
+ (case bkw
+ (:group (scope-report-s (cadr q) 'group)))
+ (setq q (cddr q)))))
+
(scope-define-macro-analyzer define-globalized-minor-mode (l global mode turn-on &rest body)
(scope-report-s mode 'function)
(scope-report-s turn-on 'function)
(put name 'scope-parent-types nil)
(put name 'scope-type-properties nil)))
+(cl-defmethod loadhist-unload-element ((x (head define-icon)))
+ (let ((name (cdr x))) (put name 'icon--properties nil)))
+
;;;###autoload
(defun unload-feature (feature &optional force)
"Unload the library that provided FEATURE.
(feature '(feature))
(widget-type '(widget-type))
(condition '(condition))
+ (icon '(deficon icon))
(variable '(defvar variable constant))
(symbol-type '(symbol-type symbol-type-definition))
(function '(defun function macro special-form major-mode)))))
('face '(defface))
('feature '(feature))
('condition '(define-error))
+ ('icon '(define-icon))
('symbol-type '(define-symbol-type))
('widget-type '(define-widget)))))
(cl-loop for d in definitions
(when-let ((file (find-lisp-object-file-name symbol 'define-error)))
(push (elisp--xref-make-xref 'define-error symbol file) xrefs)))
+ (when (get symbol 'icon--properties)
+ (when-let ((file (find-lisp-object-file-name symbol 'define-icon)))
+ (push (elisp--xref-make-xref 'define-icon symbol file) xrefs)))
+
(when (scope-symbol-type-p symbol)
(when-let ((file (find-lisp-object-file-name symbol 'define-symbol-type)))
(push (elisp--xref-make-xref 'define-symbol-type symbol file) xrefs)))
(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-symbols-index-1 file)))
elisp-symbols-index-cache)