aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEshel Yaron2025-09-30 18:30:44 +0200
committerEshel Yaron2025-09-30 18:58:23 +0200
commit3ebd0efd094e9ded715baa2db64ab818a95e56dc (patch)
treea8c459fe2e93d70efd49b4227255725a4c999adc
parentc6ee775cb29214c40b7e13ef39e5b80855f64200 (diff)
downloademacs-3ebd0efd094e9ded715baa2db64ab818a95e56dc.tar.gz
emacs-3ebd0efd094e9ded715baa2db64ab818a95e56dc.zip
; elisp-scope.el: Update multiple function handlers.
Update all remaining function handlers to use 'elisp-scope-define-func-analyzer' instead of 'elisp-scope-define-function-analyzer'. The difference is that the former handles all arguments explicitly, while the latter analyzes all arguments as evaluated forms automatically. By handling the arguments explicitly, we get a chance to specify the expected type of different arguments. Lastly, since 'elisp-scope-define-function-analyzer' is now unused, rename 'elisp-scope-define-func-analyzer' to 'elisp-scope-define-function-analyzer'.
-rw-r--r--lisp/emacs-lisp/elisp-scope.el489
1 files changed, 278 insertions, 211 deletions
diff --git a/lisp/emacs-lisp/elisp-scope.el b/lisp/emacs-lisp/elisp-scope.el
index 74f7fd93ae3..b38af830488 100644
--- a/lisp/emacs-lisp/elisp-scope.el
+++ b/lisp/emacs-lisp/elisp-scope.el
@@ -1631,34 +1631,16 @@ trusted code macro expansion is always safe."
1631 1631
1632(defmacro elisp-scope--define-function-analyzer (fsym args type &rest body) 1632(defmacro elisp-scope--define-function-analyzer (fsym args type &rest body)
1633 (declare (indent defun)) 1633 (declare (indent defun))
1634 (let* ((helper (intern (concat "elisp-scope--analyze-" (symbol-name fsym) "-1")))) 1634 (let ((helper (intern (concat "elisp-scope--analyze-" (symbol-name fsym) "-1"))))
1635 `(progn 1635 `(progn
1636 (defun ,helper ,args ,@body) 1636 (defun ,helper ,args ,@body)
1637 (elisp-scope-define-analyzer ,fsym (f &rest args) 1637 (elisp-scope-define-analyzer ,fsym (f &rest args)
1638 (elisp-scope-report-s f ',type) 1638 (elisp-scope-report-s f ',type)
1639 (apply #',helper args) 1639 (apply #',helper args)))))
1640 (elisp-scope-n args)))))
1641 1640
1642(defmacro elisp-scope-define-function-analyzer (fsym args &rest body) 1641(defmacro elisp-scope-define-function-analyzer (fsym args &rest body)
1643 (declare (indent defun)) 1642 (declare (indent defun))
1644 `(elisp-scope--define-function-analyzer ,fsym ,args function ,@body) 1643 `(elisp-scope--define-function-analyzer ,fsym ,args function ,@body))
1645 ;; (let* ((helper (intern (concat "elisp-scope--analyze-" (symbol-name fsym) "-1"))))
1646 ;; `(progn
1647 ;; (defun ,helper ,args ,@body)
1648 ;; (elisp-scope-define-analyzer ,fsym (l f &rest args)
1649 ;; (elisp-scope-report-s f 'function)
1650 ;; (apply #',helper args)
1651 ;; (elisp-scope-n l args))))
1652 )
1653
1654(defmacro elisp-scope-define-func-analyzer (fsym args &rest body)
1655 (declare (indent defun))
1656 (let* ((helper (intern (concat "elisp-scope--analyze-" (symbol-name fsym) "-1"))))
1657 `(progn
1658 (defun ,helper ,args ,@body)
1659 (elisp-scope-define-analyzer ,fsym (f &rest args)
1660 (elisp-scope-report-s f 'function)
1661 (apply #',helper args)))))
1662 1644
1663(defmacro elisp-scope-define-macro-analyzer (fsym args &rest body) 1645(defmacro elisp-scope-define-macro-analyzer (fsym args &rest body)
1664 (declare (indent defun)) 1646 (declare (indent defun))
@@ -1696,45 +1678,46 @@ trusted code macro expansion is always safe."
1696 (elisp-scope-1 form)) 1678 (elisp-scope-1 form))
1697 (elisp-scope-1 lexical)) 1679 (elisp-scope-1 lexical))
1698 1680
1699(elisp-scope-define-func-analyzer funcall (&optional f &rest args) 1681(elisp-scope-define-function-analyzer funcall (&optional f &rest args)
1700 (elisp-scope-1 f '(symbol . function)) 1682 (elisp-scope-1 f '(symbol . function))
1701 (dolist (arg args) (elisp-scope-1 arg))) 1683 (elisp-scope-n args))
1702 1684
1703(put 'apply 'elisp-scope-analyzer #'elisp-scope--analyze-funcall) 1685(put 'apply 'elisp-scope-analyzer #'elisp-scope--analyze-funcall)
1704 1686
1705(elisp-scope-define-func-analyzer defalias (&optional sym def docstring) 1687(elisp-scope-define-function-analyzer defalias (&optional sym def docstring)
1706 (elisp-scope-1 sym '(symbol . defun)) 1688 (elisp-scope-1 sym '(symbol . defun))
1707 (elisp-scope-1 def '(symbol . defun)) 1689 (elisp-scope-1 def '(symbol . defun))
1708 (elisp-scope-1 docstring)) 1690 (elisp-scope-1 docstring))
1709 1691
1710(elisp-scope-define-function-analyzer oclosure--define 1692(elisp-scope-define-function-analyzer oclosure--define
1711 (&optional name _docstring parent-names _slots &rest props) 1693 (&optional name docstring parent-names slots &rest props)
1712 (when-let* ((quoted (elisp-scope--unquote name))) (elisp-scope-report-s quoted 'defoclosure)) 1694 (elisp-scope-1 name '(symbol . defoclosure))
1713 (when-let* ((qs (elisp-scope--unquote parent-names))) 1695 (elisp-scope-1 docstring)
1714 (dolist (q qs) 1696 (elisp-scope-1 parent-names '(repeat . (symbol . oclosure)))
1715 (elisp-scope-report-s q 'oclosure))) 1697 (elisp-scope-1 slots) ;TODO: Specify type of `slots'.
1716 (while-let ((kw (car-safe props)) 1698 (while-let ((kw (car-safe props))
1717 (bkw (elisp-scope-sym-bare kw)) 1699 (bkw (elisp-scope-sym-bare kw))
1718 ((keywordp bkw))) 1700 ((keywordp bkw)))
1719 (elisp-scope-report-s kw 'constant) 1701 (elisp-scope-report-s kw 'constant)
1720 (cl-case bkw 1702 (elisp-scope-1 (cadr props) (when (eq bkw :predicate) '(symbol . defun)))
1721 (:predicate 1703 (setq props (cddr props)))
1722 (when-let* ((q (elisp-scope--unquote (cadr props)))) (elisp-scope-report-s q 'defun)))) 1704 (when props (elisp-scope-n props)))
1723 (setq props (cddr props))))
1724 1705
1725(elisp-scope-define-function-analyzer define-charset 1706(elisp-scope-define-function-analyzer define-charset
1726 (&optional name _docstring &rest _props) 1707 (&optional name docstring &rest props)
1727 (when-let* ((quoted (elisp-scope--unquote name))) (elisp-scope-report-s quoted 'defcharset))) 1708 (elisp-scope-1 name '(symbol . defcharset))
1709 (elisp-scope-1 docstring)
1710 (elisp-scope-n props))
1728 1711
1729(elisp-scope-define-function-analyzer define-charset-alias 1712(elisp-scope-define-function-analyzer define-charset-alias
1730 (&optional alias charset) 1713 (&optional alias charset)
1731 (when-let* ((quoted (elisp-scope--unquote alias))) (elisp-scope-report-s quoted 'defcharset)) 1714 (elisp-scope-1 alias '(symbol . defcharset))
1732 (when-let* ((quoted (elisp-scope--unquote charset))) (elisp-scope-report-s quoted 'charset))) 1715 (elisp-scope-1 charset '(symbol . charset)))
1733 1716
1734(elisp-scope-define-func-analyzer charset-chars 1717(elisp-scope-define-function-analyzer charset-chars
1735 (&optional charset &rest rest) 1718 (&optional charset &rest rest)
1736 (elisp-scope-1 charset '(symbol . charset)) 1719 (elisp-scope-1 charset '(symbol . charset))
1737 (mapc #'elisp-scope-1 rest)) 1720 (elisp-scope-n rest))
1738 1721
1739(dolist (sym '(charset-description charset-info charset-iso-final-char 1722(dolist (sym '(charset-description charset-info charset-iso-final-char
1740 charset-long-name charset-plist 1723 charset-long-name charset-plist
@@ -1747,32 +1730,38 @@ trusted code macro expansion is always safe."
1747 locale-charset-to-coding-system)) 1730 locale-charset-to-coding-system))
1748 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-charset-chars)) 1731 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-charset-chars))
1749 1732
1750(elisp-scope-define-func-analyzer define-coding-system 1733(elisp-scope-define-function-analyzer define-coding-system
1751 (&optional name &rest rest) 1734 (&optional name &rest rest)
1752 (elisp-scope-1 name '(symbol . defcoding)) 1735 (elisp-scope-1 name '(symbol . defcoding))
1753 (mapc #'elisp-scope-1 rest)) 1736 (mapc #'elisp-scope-1 rest))
1754 1737
1755(elisp-scope-define-func-analyzer define-coding-system-alias 1738(elisp-scope-define-function-analyzer define-coding-system-alias
1756 (&optional alias coding-system) 1739 (&optional alias coding-system)
1757 (elisp-scope-1 alias '(symbol . defcoding)) 1740 (elisp-scope-1 alias '(symbol . defcoding))
1758 (elisp-scope-1 coding-system '(symbol . coding))) 1741 (elisp-scope-1 coding-system '(symbol . coding)))
1759 1742
1760(elisp-scope-define-function-analyzer decode-coding-region 1743(elisp-scope-define-function-analyzer decode-coding-region
1761 (&optional _start _end coding-system &rest _) 1744 (&optional start end coding-system &rest rest)
1762 (when-let* ((quoted (elisp-scope--unquote coding-system))) (elisp-scope-report-s quoted 'coding))) 1745 (elisp-scope-1 start)
1746 (elisp-scope-1 end)
1747 (elisp-scope-1 coding-system '(symbol . coding))
1748 (elisp-scope-n rest))
1763 1749
1764(put 'encode-coding-region 'elisp-scope-analyzer #'elisp-scope--analyze-decode-coding-region) 1750(put 'encode-coding-region 'elisp-scope-analyzer #'elisp-scope--analyze-decode-coding-region)
1765 1751
1766(elisp-scope-define-function-analyzer decode-coding-string 1752(elisp-scope-define-function-analyzer decode-coding-string
1767 (&optional _string coding-system &rest _) 1753 (&optional string coding-system &rest rest)
1768 (when-let* ((quoted (elisp-scope--unquote coding-system))) (elisp-scope-report-s quoted 'coding))) 1754 (elisp-scope-1 string)
1755 (elisp-scope-1 coding-system '(symbol . coding))
1756 (elisp-scope-n rest))
1769 1757
1770(dolist (sym '(encode-coding-char encode-coding-string)) 1758(dolist (sym '(encode-coding-char encode-coding-string))
1771 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-decode-coding-string)) 1759 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-decode-coding-string))
1772 1760
1773(elisp-scope-define-function-analyzer coding-system-mnemonic 1761(elisp-scope-define-function-analyzer coding-system-mnemonic
1774 (&optional coding-system &rest _) 1762 (&optional coding-system &rest rest)
1775 (when-let* ((quoted (elisp-scope--unquote coding-system))) (elisp-scope-report-s quoted 'coding))) 1763 (elisp-scope-1 coding-system '(symbol . coding))
1764 (elisp-scope-n rest))
1776 1765
1777(dolist (sym '(add-to-coding-system-list 1766(dolist (sym '(add-to-coding-system-list
1778 check-coding-system 1767 check-coding-system
@@ -1810,7 +1799,7 @@ trusted code macro expansion is always safe."
1810 universal-coding-system-argument)) 1799 universal-coding-system-argument))
1811 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-coding-system-mnemonic)) 1800 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-coding-system-mnemonic))
1812 1801
1813(elisp-scope-define-func-analyzer thing-at-point (&optional thing no-props) 1802(elisp-scope-define-function-analyzer thing-at-point (&optional thing no-props)
1814 (elisp-scope-1 thing '(symbol . thing)) 1803 (elisp-scope-1 thing '(symbol . thing))
1815 (elisp-scope-1 no-props)) 1804 (elisp-scope-1 no-props))
1816 1805
@@ -1820,48 +1809,60 @@ trusted code macro expansion is always safe."
1820 bounds-of-thing-at-point)) 1809 bounds-of-thing-at-point))
1821 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-thing-at-point)) 1810 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-thing-at-point))
1822 1811
1823(elisp-scope-define-func-analyzer bounds-of-thing-at-mouse (&optional event thing) 1812(elisp-scope-define-function-analyzer bounds-of-thing-at-mouse (&optional event thing)
1824 (elisp-scope-1 event) 1813 (elisp-scope-1 event)
1825 (elisp-scope-1 thing '(symbol . thing))) 1814 (elisp-scope-1 thing '(symbol . thing)))
1826 1815
1827(elisp-scope-define-func-analyzer thing-at-mouse (&optional event thing no-props) 1816(elisp-scope-define-function-analyzer thing-at-mouse (&optional event thing no-props)
1828 (elisp-scope-1 event) 1817 (elisp-scope-1 event)
1829 (elisp-scope-1 thing '(symbol . thing)) 1818 (elisp-scope-1 thing '(symbol . thing))
1830 (elisp-scope-1 no-props)) 1819 (elisp-scope-1 no-props))
1831 1820
1832(elisp-scope-define-function-analyzer custom-declare-variable (sym _default _doc &rest args) 1821(elisp-scope-define-function-analyzer custom-declare-variable (sym default doc &rest args)
1833 (when-let* ((quoted (elisp-scope--unquote sym))) (elisp-scope-report-s quoted 'defvar)) 1822 (elisp-scope-1 sym '(symbol . defvar))
1823 (elisp-scope-1 default)
1824 (elisp-scope-1 doc)
1834 (while-let ((kw (car-safe args)) 1825 (while-let ((kw (car-safe args))
1835 (bkw (elisp-scope-sym-bare kw)) 1826 (bkw (elisp-scope-sym-bare kw))
1836 ((keywordp bkw))) 1827 ((keywordp bkw)))
1828 (elisp-scope-report-s kw 'constant)
1837 (cl-case bkw 1829 (cl-case bkw
1838 (:type 1830 (:type
1839 (when-let* ((quoted (elisp-scope--unquote (cadr args)))) (elisp-scope-widget-type-1 quoted))) 1831 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
1832 (if-let* ((quoted (elisp-scope--unquote (cadr args))))
1833 (elisp-scope-widget-type-1 quoted)
1834 (elisp-scope-1 (cadr args))))
1840 (:group 1835 (:group
1841 (when-let* ((quoted (elisp-scope--unquote (cadr args)))) (elisp-scope-report-s quoted 'group)))) 1836 (elisp-scope-1 (cadr args) '(symbol . group)))
1842 (setq args (cddr args)))) 1837 (otherwise (elisp-scope-1 (cadr args))))
1843 1838 (setq args (cddr args)))
1844(elisp-scope-define-function-analyzer custom-declare-group (sym _members _doc &rest args) 1839 (when args (elisp-scope-n args)))
1845 (when-let* ((quoted (elisp-scope--unquote sym))) (elisp-scope-report-s quoted 'defgroup)) 1840
1841(elisp-scope-define-function-analyzer custom-declare-group (sym members doc &rest args)
1842 (elisp-scope-1 sym '(symbol . defgroup))
1843 (elisp-scope-1 members)
1844 (elisp-scope-1 doc '(symbol . defgroup))
1846 (while-let ((kw (car-safe args)) 1845 (while-let ((kw (car-safe args))
1847 (bkw (elisp-scope-sym-bare kw)) 1846 (bkw (elisp-scope-sym-bare kw))
1848 ((keywordp bkw))) 1847 ((keywordp bkw)))
1849 (cl-case bkw 1848 (elisp-scope-report-s kw 'constant)
1850 (:group 1849 (elisp-scope-1 (cadr args) (when (eq bkw :group) '(symbol . group)))
1851 (when-let* ((quoted (elisp-scope--unquote (cadr args)))) (elisp-scope-report-s quoted 'group)))) 1850 (setq args (cddr args)))
1852 (setq args (cddr args)))) 1851 (when args (elisp-scope-n args)))
1853 1852
1854(elisp-scope-define-function-analyzer custom-declare-face (face spec _doc &rest args) 1853(elisp-scope-define-function-analyzer custom-declare-face (face spec doc &rest args)
1855 (when-let* ((q (elisp-scope--unquote face))) (elisp-scope-report-s q 'defface)) 1854 (elisp-scope-1 face '(symbol . defface))
1855 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
1856 (when-let* ((q (elisp-scope--unquote spec))) 1856 (when-let* ((q (elisp-scope--unquote spec)))
1857 (when (consp q) (dolist (s q) (elisp-scope-face (cdr s))))) 1857 (when (consp q) (dolist (s q) (elisp-scope-face (cdr s)))))
1858 (elisp-scope-1 doc)
1858 (while-let ((kw (car-safe args)) 1859 (while-let ((kw (car-safe args))
1859 (bkw (elisp-scope-sym-bare kw)) 1860 (bkw (elisp-scope-sym-bare kw))
1860 ((keywordp bkw))) 1861 ((keywordp bkw)))
1861 (cl-case bkw 1862 (elisp-scope-report-s kw 'constant)
1862 (:group 1863 (elisp-scope-1 (cadr args) (when (eq bkw :group) '(symbol . group)))
1863 (when-let* ((q (elisp-scope--unquote (cadr args)))) (elisp-scope-report-s q 'group)))) 1864 (setq args (cddr args)))
1864 (setq args (cddr args)))) 1865 (when args (elisp-scope-n args)))
1865 1866
1866(defun elisp-scope-typep (type) 1867(defun elisp-scope-typep (type)
1867 (cond 1868 (cond
@@ -1875,46 +1876,58 @@ trusted code macro expansion is always safe."
1875 ((eq (elisp-scope-sym-bare (car type)) 'satisfies) 1876 ((eq (elisp-scope-sym-bare (car type)) 'satisfies)
1876 (elisp-scope-report-s (cadr type) 'function)))))) 1877 (elisp-scope-report-s (cadr type) 'function))))))
1877 1878
1878(elisp-scope-define-function-analyzer cl-typep (_val type) 1879(elisp-scope-define-function-analyzer cl-typep (val type)
1880 (elisp-scope-1 val)
1881 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
1879 (when-let* ((q (elisp-scope--unquote type))) 1882 (when-let* ((q (elisp-scope--unquote type)))
1880 (elisp-scope-typep q))) 1883 (elisp-scope-typep q)))
1881 1884
1882(elisp-scope-define-function-analyzer pulse-momentary-highlight-region (_start _end &optional face) 1885(elisp-scope-define-function-analyzer pulse-momentary-highlight-region (start end &optional face)
1883 (when-let* ((q (elisp-scope--unquote face))) (elisp-scope-face q))) 1886 (elisp-scope-1 start)
1887 (elisp-scope-1 end)
1888 (elisp-scope-1 face '(symbol . face)))
1884 1889
1885(elisp-scope--define-function-analyzer throw (tag _value) non-local-exit 1890(elisp-scope--define-function-analyzer throw (&optional tag val) non-local-exit
1886 (when-let* ((q (elisp-scope--unquote tag))) (elisp-scope-report-s q 'throw-tag))) 1891 (elisp-scope-1 tag '(symbol . throw-tag))
1892 (elisp-scope-1 val))
1893
1894(elisp-scope--define-function-analyzer signal (&optional error-symbol data) non-local-exit
1895 (elisp-scope-1 error-symbol '(symbol . condition))
1896 (elisp-scope-1 data))
1887 1897
1888(elisp-scope--define-function-analyzer signal (error-symbol &optional _data) non-local-exit 1898(elisp-scope--define-function-analyzer kill-emacs (&rest rest) non-local-exit
1889 (when-let* ((q (elisp-scope--unquote error-symbol))) (elisp-scope-report-s q 'condition))) 1899 (elisp-scope-n rest))
1890 1900
1891(elisp-scope--define-function-analyzer kill-emacs (&rest _) non-local-exit) 1901(dolist (sym '( abort-recursive-edit top-level exit-recursive-edit
1892(elisp-scope--define-function-analyzer abort-recursive-edit (&rest _) non-local-exit) 1902 tty-frame-restack error user-error
1893(elisp-scope--define-function-analyzer top-level (&rest _) non-local-exit) 1903 minibuffer-quit-recursive-edit exit-minibuffer))
1894(elisp-scope--define-function-analyzer exit-recursive-edit (&rest _) non-local-exit) 1904 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-kill-emacs))
1895(elisp-scope--define-function-analyzer tty-frame-restack (&rest _) non-local-exit)
1896(elisp-scope--define-function-analyzer error (&rest _) non-local-exit)
1897(elisp-scope--define-function-analyzer user-error (&rest _) non-local-exit)
1898(elisp-scope--define-function-analyzer minibuffer-quit-recursive-edit (&rest _) non-local-exit)
1899(elisp-scope--define-function-analyzer exit-minibuffer (&rest _) non-local-exit)
1900 1905
1901(elisp-scope-define-func-analyzer run-hooks (&rest hooks) 1906(elisp-scope-define-function-analyzer run-hooks (&rest hooks)
1902 (dolist (hook hooks) (elisp-scope-1 hook '(symbol . variable)))) 1907 (dolist (hook hooks) (elisp-scope-1 hook '(symbol . variable))))
1903 1908
1904(elisp-scope-define-func-analyzer fboundp (&optional symbol) 1909(elisp-scope-define-function-analyzer fboundp (&optional symbol)
1905 (elisp-scope-1 symbol '(symbol . function))) 1910 (elisp-scope-1 symbol '(symbol . function)))
1906 1911
1907(elisp-scope-define-function-analyzer overlay-put (&optional _ov prop val) 1912(elisp-scope-define-function-analyzer overlay-put (&optional ov prop val)
1908 (when-let* ((q (elisp-scope--unquote prop)) 1913 (elisp-scope-1 ov)
1909 ((eq (elisp-scope-sym-bare q) 'face)) 1914 (elisp-scope-1 prop) ;TODO: Recognize overlay props.
1910 (face (elisp-scope--unquote val))) 1915 (if-let* ((q (elisp-scope--unquote prop))
1911 (elisp-scope-face face))) 1916 ((eq (elisp-scope-sym-bare q) 'face))
1912 1917 (face (elisp-scope--unquote val)))
1913(elisp-scope-define-function-analyzer add-face-text-property (&optional _start _end face &rest _) 1918 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
1914 (when-let* ((q (elisp-scope--unquote face))) (elisp-scope-face q))) 1919 (elisp-scope-face face)
1920 (elisp-scope-1 val)))
1921
1922(elisp-scope-define-function-analyzer add-face-text-property (&optional start end face &rest rest)
1923 (elisp-scope-1 start)
1924 (elisp-scope-1 end)
1925 (elisp-scope-1 face '(symbol . face))
1926 (elisp-scope-n rest))
1915 1927
1916(elisp-scope-define-function-analyzer facep (&optional face &rest _) 1928(elisp-scope-define-function-analyzer facep (&optional face &rest rest)
1917 (when-let* ((q (elisp-scope--unquote face))) (elisp-scope-report-s q 'face))) 1929 (elisp-scope-1 face '(symbol . face))
1930 (elisp-scope-n rest))
1918 1931
1919(dolist (sym '( check-face face-id face-differs-from-default-p 1932(dolist (sym '( check-face face-id face-differs-from-default-p
1920 face-name face-all-attributes face-attribute 1933 face-name face-all-attributes face-attribute
@@ -1927,9 +1940,9 @@ trusted code macro expansion is always safe."
1927 set-face-bold set-face-italic set-face-extend)) 1940 set-face-bold set-face-italic set-face-extend))
1928 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-facep)) 1941 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-facep))
1929 1942
1930(elisp-scope-define-func-analyzer boundp (&optional var &rest rest) 1943(elisp-scope-define-function-analyzer boundp (&optional var &rest rest)
1931 (elisp-scope-1 var '(symbol . variable)) 1944 (elisp-scope-1 var '(symbol . variable))
1932 (mapc #'elisp-scope-1 rest)) 1945 (elisp-scope-n rest))
1933 1946
1934(dolist (sym '( set symbol-value define-abbrev-table 1947(dolist (sym '( set symbol-value define-abbrev-table
1935 special-variable-p local-variable-p 1948 special-variable-p local-variable-p
@@ -1941,141 +1954,187 @@ trusted code macro expansion is always safe."
1941 add-hook remove-hook run-hook-with-args run-hook-wrapped)) 1954 add-hook remove-hook run-hook-with-args run-hook-wrapped))
1942 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-boundp)) 1955 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-boundp))
1943 1956
1944(elisp-scope-define-function-analyzer defvaralias (new base &optional _docstring) 1957(elisp-scope-define-function-analyzer defvaralias (new base &optional docstring)
1945 (when-let* ((q (elisp-scope--unquote new))) (elisp-scope-report-s q 'defvar)) 1958 (elisp-scope-1 new '(symbol . defvar))
1946 (when-let* ((q (elisp-scope--unquote base))) (elisp-scope-report-s q 'variable))) 1959 (elisp-scope-1 base '(symbol . variable))
1960 (elisp-scope-1 docstring))
1947 1961
1948(elisp-scope-define-func-analyzer define-error (&optional name message parent) 1962(elisp-scope-define-function-analyzer define-error (&optional name message parent)
1949 (elisp-scope-1 name '(symbol . defcondition)) 1963 (elisp-scope-1 name '(symbol . defcondition))
1950 (elisp-scope-1 message) 1964 (elisp-scope-1 message)
1951 (elisp-scope-1 parent '(or (symbol . condition) 1965 (elisp-scope-1 parent '(or (symbol . condition)
1952 (repeat . (symbol . condition))))) 1966 (repeat . (symbol . condition)))))
1953 1967
1954(elisp-scope-define-function-analyzer featurep (feature &rest _) 1968(elisp-scope-define-function-analyzer featurep (feature &rest rest)
1955 (when-let* ((q (elisp-scope--unquote feature))) (elisp-scope-report-s q 'feature))) 1969 (elisp-scope-1 feature '(symbol . feature))
1970 (elisp-scope-n rest))
1956 1971
1957(put 'require 'elisp-scope-analyzer #'elisp-scope--analyze-featurep) 1972(put 'require 'elisp-scope-analyzer #'elisp-scope--analyze-featurep)
1958 1973
1959(elisp-scope-define-function-analyzer provide (feature &rest _) 1974(elisp-scope-define-function-analyzer provide (feature &rest rest)
1960 (when-let* ((q (elisp-scope--unquote feature))) (elisp-scope-report-s q 'deffeature))) 1975 (elisp-scope-1 feature '(symbol . deffeature))
1976 (elisp-scope-n rest))
1961 1977
1962(elisp-scope-define-function-analyzer put-text-property (&optional _ _ prop val _) 1978(elisp-scope-define-function-analyzer put-text-property (&optional beg end prop val obj)
1963 (when (memq (elisp-scope-sym-bare (elisp-scope--unquote prop)) '(mouse-face face)) 1979 (elisp-scope-1 beg)
1964 (when-let* ((q (elisp-scope--unquote val))) (elisp-scope-face q)))) 1980 (elisp-scope-1 end)
1981 (elisp-scope-1 prop)
1982 (if-let* (((memq (elisp-scope-sym-bare (elisp-scope--unquote prop))
1983 '(mouse-face face)))
1984 (q (elisp-scope--unquote val)))
1985 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
1986 (elisp-scope-face q)
1987 (elisp-scope-1 val))
1988 (elisp-scope-1 obj))
1965 1989
1966(put 'remove-overlays 'elisp-scope-analyzer #'elisp-scope--analyze-put-text-property) 1990(put 'remove-overlays 'elisp-scope-analyzer #'elisp-scope--analyze-put-text-property)
1967 1991
1968(elisp-scope-define-function-analyzer propertize (_string &rest props) 1992(elisp-scope-define-function-analyzer propertize (string &rest props)
1993 (elisp-scope-1 string)
1969 (while props 1994 (while props
1995 (elisp-scope-1 (car props))
1970 (cl-case (elisp-scope-sym-bare (elisp-scope--unquote (car props))) 1996 (cl-case (elisp-scope-sym-bare (elisp-scope--unquote (car props)))
1971 ((face mouse-face) 1997 ((face mouse-face)
1972 (when-let* ((q (elisp-scope--unquote (cadr props)))) (elisp-scope-face q)))) 1998 (if-let* ((q (elisp-scope--unquote (cadr props))))
1973 (setq props (cddr props)))) 1999 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
2000 (elisp-scope-face q)
2001 (elisp-scope-1 (cadr props))))
2002 (otherwise (elisp-scope-1 (cadr props))))
2003 (setq props (cddr props)))
2004 (when props (elisp-scope-n props)))
1974 2005
1975(elisp-scope-define-function-analyzer eieio-defclass-internal (name superclasses _ _) 2006(elisp-scope-define-function-analyzer eieio-defclass-internal
1976 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'deftype)) 2007 (&optional name superclasses slots options)
1977 (when-let* ((q (elisp-scope--unquote superclasses))) 2008 (elisp-scope-1 name '(symbol . deftype))
1978 (dolist (sup q) (elisp-scope-report-s sup 'type)))) 2009 (elisp-scope-1 superclasses '(repeat . (symbol . type)))
2010 (elisp-scope-1 slots) ;TODO: Specify type of `slots'.
2011 (elisp-scope-1 options))
1979 2012
1980(elisp-scope-define-function-analyzer cl-struct-define 2013(elisp-scope-define-function-analyzer cl-struct-define
1981 (name _doc parent _type _named _slots _children _tab _print) 2014 (&optional name doc parent type named slots children tag print)
1982 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'deftype)) 2015 (elisp-scope-1 name '(symbol . deftype))
1983 (when-let* ((q (elisp-scope--unquote parent))) (elisp-scope-report-s q 'type))) 2016 (elisp-scope-1 doc)
1984 2017 (elisp-scope-1 parent '(symbol . type))
1985(elisp-scope-define-function-analyzer define-widget (name class _doc &rest args) 2018 (elisp-scope-1 type)
1986 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'widget-type)) 2019 (elisp-scope-1 named)
1987 (when-let* ((q (elisp-scope--unquote class))) (elisp-scope-report-s q 'widget-type)) 2020 (elisp-scope-1 slots) ;TODO: Specify type of `slots'.
2021 (elisp-scope-1 children)
2022 (elisp-scope-1 tag)
2023 (elisp-scope-1 print))
2024
2025(elisp-scope-define-function-analyzer define-widget (name class doc &rest args)
2026 (elisp-scope-1 name '(symbol . widget-type-definition))
2027 (elisp-scope-1 class '(symbol . widget-type))
2028 (elisp-scope-1 doc)
1988 (while-let ((kw (car-safe args)) 2029 (while-let ((kw (car-safe args))
1989 (bkw (elisp-scope-sym-bare kw)) 2030 (bkw (elisp-scope-sym-bare kw))
1990 ((keywordp bkw))) 2031 ((keywordp bkw)))
2032 (elisp-scope-report-s kw 'constant)
1991 (cl-case bkw 2033 (cl-case bkw
1992 (:type 2034 (:type
1993 (when-let* ((q (elisp-scope--unquote (cadr args)))) (elisp-scope-widget-type-1 q))) 2035 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
2036 (if-let* ((quoted (elisp-scope--unquote (cadr args))))
2037 (elisp-scope-widget-type-1 quoted)
2038 (elisp-scope-1 (cadr args))))
1994 (:args 2039 (:args
1995 (when-let* ((q (elisp-scope--unquote (cadr args)))) (mapc #'elisp-scope-widget-type-1 q)))) 2040 (if-let* ((quoted (elisp-scope--unquote (cadr args))))
1996 (setq args (cddr args)))) 2041 (mapc #'elisp-scope-widget-type-1 quoted)
1997 2042 (elisp-scope-1 (cadr args))))
1998(elisp-scope-define-function-analyzer provide-theme (name &rest _) 2043 (otherwise (elisp-scope-1 (cadr args))))
1999 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'theme))) 2044 (setq args (cddr args)))
2045 (when args (elisp-scope-n args)))
2046
2047(elisp-scope-define-function-analyzer provide-theme (name &rest rest)
2048 (elisp-scope-1 name '(symbol . theme))
2049 (elisp-scope-n rest))
2000 2050
2001(dolist (sym '(enable-theme disable-theme load-theme custom-theme-p)) 2051(dolist (sym '(enable-theme disable-theme load-theme custom-theme-p))
2002 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-provide-theme)) 2052 (put sym 'elisp-scope-analyzer #'elisp-scope--analyze-provide-theme))
2003 2053
2004(elisp-scope-define-function-analyzer custom-theme-set-variables (theme &rest args) 2054(elisp-scope-define-function-analyzer custom-theme-set-variables (theme &rest args)
2005 (when-let* ((q (elisp-scope--unquote theme))) (elisp-scope-report-s q 'theme)) 2055 (elisp-scope-1 theme '(symbol . theme))
2006 (dolist (arg args) 2056 (dolist (arg args)
2007 (when-let* ((q (elisp-scope--unquote arg))) 2057 (elisp-scope-1
2008 (when (consp q) 2058 arg
2009 (elisp-scope-report-s (pop q) 'variable) 2059 '(cons (symbol . variable) .
2010 (when (consp q) 2060 (cons code .
2011 (elisp-scope-1 (pop q)) 2061 (or (cons t .
2012 (dolist (request (car (cdr-safe q))) 2062 (cons (repeat . (symbol . feature)) .
2013 (elisp-scope-report-s request 'feature))))))) 2063 t))
2014 2064 t))))))
2015(elisp-scope-define-function-analyzer custom-declare-theme (name &rest _) 2065
2016 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'deftheme))) 2066(elisp-scope-define-function-analyzer custom-declare-theme (name &rest rest)
2067 (elisp-scope-1 name '(symbol . deftheme))
2068 (elisp-scope-n rest))
2017 2069
2018(elisp-scope-define-function-analyzer eieio-oref (_obj slot) 2070(elisp-scope-define-function-analyzer eieio-oref (obj slot)
2019 (when-let* ((q (elisp-scope--unquote slot))) (elisp-scope-report-s q 'slot))) 2071 (elisp-scope-1 obj)
2072 (elisp-scope-1 slot '(symbol . slot)))
2020 2073
2021(dolist (fun '(slot-boundp slot-makeunbound slot-exists-p eieio-oref-default)) 2074(dolist (fun '(slot-boundp slot-makeunbound slot-exists-p eieio-oref-default))
2022 (put fun 'elisp-scope-analyzer #'elisp-scope--analyze-eieio-oref)) 2075 (put fun 'elisp-scope-analyzer #'elisp-scope--analyze-eieio-oref))
2023 2076
2024(elisp-scope-define-function-analyzer eieio-oset (_obj slot _value) 2077(elisp-scope-define-function-analyzer eieio-oset (obj slot value)
2025 (when-let* ((q (elisp-scope--unquote slot))) (elisp-scope-report-s q 'slot))) 2078 (elisp-scope-1 obj)
2079 (elisp-scope-1 slot '(symbol . slot))
2080 (elisp-scope-1 value))
2026 2081
2027(put 'eieio-oset-default 'elisp-scope-analyzer #'elisp-scope--analyze-eieio-oset) 2082(put 'eieio-oset-default 'elisp-scope-analyzer #'elisp-scope--analyze-eieio-oset)
2028 2083
2029(elisp-scope-define-function-analyzer derived-mode-p (modes &rest _obsolete) 2084(elisp-scope-define-function-analyzer derived-mode-p (modes &rest rest)
2030 (when-let* ((q (elisp-scope--unquote modes))) (elisp-scope-report-s q 'major-mode))) 2085 (elisp-scope-1 modes '(or (repeat . (symbol . major-mode))
2086 (symbol . major-mode)))
2087 (dolist (mode rest) (elisp-scope-1 mode '(symbol . major-mode))))
2031 2088
2032(elisp-scope-define-func-analyzer derived-mode-set-parent (&optional mode parent) 2089(elisp-scope-define-function-analyzer derived-mode-set-parent (&optional mode parent)
2033 (elisp-scope-1 mode '(symbol . major-mode)) 2090 (elisp-scope-1 mode '(symbol . major-mode))
2034 (elisp-scope-1 parent '(symbol . major-mode))) 2091 (elisp-scope-1 parent '(symbol . major-mode)))
2035 2092
2036(elisp-scope-define-func-analyzer elisp-scope-report (type &rest args) 2093(elisp-scope-define-function-analyzer elisp-scope-report (type &rest args)
2037 (elisp-scope-1 type '(symbol . symbol-type)) 2094 (elisp-scope-1 type '(symbol . symbol-type))
2038 (mapc #'elisp-scope-1 args)) 2095 (mapc #'elisp-scope-1 args))
2039 2096
2040(elisp-scope-define-func-analyzer elisp-scope-report-s (&optional sym type) 2097(elisp-scope-define-function-analyzer elisp-scope-report-s (&optional sym type)
2041 (elisp-scope-1 sym) 2098 (elisp-scope-1 sym)
2042 (elisp-scope-1 type '(symbol . symbol-type))) 2099 (elisp-scope-1 type '(symbol . symbol-type)))
2043 2100
2044(elisp-scope-define-func-analyzer elisp-scope-1 (&optional form outtype) 2101(elisp-scope-define-function-analyzer elisp-scope-1 (&optional form outtype)
2045 (elisp-scope-1 form) 2102 (elisp-scope-1 form)
2046 (elisp-scope-1 outtype 'type)) 2103 (elisp-scope-1 outtype 'type))
2047 2104
2048(elisp-scope-define-function-analyzer icons--register (&optional name parent _spec _doc kws) 2105(elisp-scope-define-function-analyzer icons--register (&optional name parent spec doc kws)
2049 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'deficon)) 2106 (elisp-scope-1 name '(symbol . deficon))
2050 (when-let* ((q (elisp-scope--unquote parent))) (elisp-scope-report-s q 'icon)) 2107 (elisp-scope-1 parent '(symbol . icon))
2051 (when-let* ((q (elisp-scope--unquote kws))) 2108 (elisp-scope-1 spec) ;TODO: Specify type of `spec'.
2052 (while-let ((kw (car-safe q)) 2109 (elisp-scope-1 doc)
2053 (bkw (elisp-scope-sym-bare kw)) 2110 (if-let* ((q (elisp-scope--unquote kws)))
2054 ((keywordp bkw))) 2111 (progn
2055 (elisp-scope-report-s kw 'constant) 2112 (while-let ((kw (car-safe q))
2056 (cl-case bkw 2113 (bkw (elisp-scope-sym-bare kw))
2057 (:group (elisp-scope-report-s (cadr q) 'group))) 2114 ((keywordp bkw)))
2058 (setq q (cddr q))))) 2115 (elisp-scope-report-s kw 'constant)
2059 2116 (elisp-scope-1 (cadr q) (when (eq bkw :group) '(symbol . group)))
2060(elisp-scope-define-function-analyzer setopt--set (&optional var _val) 2117 (setq q (cddr q)))
2061 (when-let* ((q (elisp-scope--unquote var))) (elisp-scope-report-s q 'variable))) 2118 (when q (elisp-scope-n q)))
2062 2119 (elisp-scope-1 kws)))
2063(elisp-scope-define-function-analyzer autoload (&optional func _file _doc int &rest _)
2064 (when-let* ((q (elisp-scope--unquote func))) (elisp-scope-report-s q 'function))
2065 (when-let* ((q (elisp-scope--unquote int)) ((listp q)))
2066 (dolist (mode q) (elisp-scope-report-s mode 'major-mode))))
2067
2068(elisp-scope-define-function-analyzer minibuffer--define-completion-category (&optional name parents &rest _)
2069 (when-let* ((q (elisp-scope--unquote name))) (elisp-scope-report-s q 'completion-category-definition))
2070 (when-let* ((q (elisp-scope--unquote parents)))
2071 (dolist (p (ensure-list q)) (elisp-scope-report-s p 'completion-category))))
2072 2120
2073;; (elisp-scope-define-macro-analyzer define-completion-category (l &optional name parent &rest rest) 2121(elisp-scope-define-function-analyzer setopt--set (&optional var val)
2074;; (elisp-scope-report-s name 'completion-category-definition) 2122 (elisp-scope-1 var '(symbol . variable))
2075;; (elisp-scope-report-s parent 'completion-category) 2123 (elisp-scope-1 val elisp-scope--output-type))
2076;; (elisp-scope-n l rest)) 2124
2125(elisp-scope-define-function-analyzer autoload (&optional func file doc int type)
2126 (elisp-scope-1 func '(symbol . function))
2127 (elisp-scope-1 file)
2128 (elisp-scope-1 doc)
2129 (elisp-scope-1 int '(repeat . (symbol . major-mode)))
2130 (elisp-scope-1 type))
2131
2132(elisp-scope-define-function-analyzer minibuffer--define-completion-category (&optional name parents &rest rest)
2133 (elisp-scope-1 name '(symbol . completion-category-definition))
2134 (elisp-scope-1 parents '(repeat . (symbol . completion-category)))
2135 (elisp-scope-n rest))
2077 2136
2078(elisp-scope-define-func-analyzer completion-table-with-category (&optional category table) 2137(elisp-scope-define-function-analyzer completion-table-with-category (&optional category table)
2079 (elisp-scope-1 category '(symbol . completion-category)) 2138 (elisp-scope-1 category '(symbol . completion-category))
2080 (elisp-scope-1 table)) 2139 (elisp-scope-1 table))
2081 2140
@@ -2105,30 +2164,40 @@ trusted code macro expansion is always safe."
2105 (setq it (cddr it)))))) 2164 (setq it (cddr it))))))
2106 ((consp item) (elisp-scope--easy-menu-do-define-menu item)))))) 2165 ((consp item) (elisp-scope--easy-menu-do-define-menu item))))))
2107 2166
2108(elisp-scope-define-function-analyzer easy-menu-do-define (&optional _symbol _maps _doc menu) 2167(elisp-scope-define-function-analyzer easy-menu-do-define (&optional symbol maps doc menu)
2109 (when-let* ((q (elisp-scope--unquote menu))) 2168 (elisp-scope-1 symbol)
2110 (elisp-scope--easy-menu-do-define-menu q))) 2169 (elisp-scope-1 maps)
2111 2170 (elisp-scope-1 doc)
2112(elisp-scope-define-function-analyzer define-key (&optional _keymaps _key def _remove) 2171 (if-let* ((q (elisp-scope--unquote menu)))
2113 (when-let* ((q (elisp-scope--unquote def))) 2172 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
2114 (cond 2173 (elisp-scope--easy-menu-do-define-menu q)
2115 ((eq (elisp-scope-sym-bare (car-safe q)) 'menu-item) 2174 (elisp-scope-1 menu)))
2116 (let ((fn (caddr q)) (it (cdddr q))) 2175
2117 (elisp-scope-sharpquote fn) 2176(elisp-scope-define-function-analyzer define-key (&optional keymap key def remove)
2118 (while-let ((kw (car-safe it)) 2177 (elisp-scope-1 keymap)
2119 (bkw (elisp-scope-sym-bare kw)) 2178 (elisp-scope-1 key)
2120 ((keywordp bkw))) 2179 (if-let* ((q (elisp-scope--unquote def)))
2121 (elisp-scope-report-s kw 'constant) 2180 ;; TODO: Use `elisp-scope-1' with an appropriate outtype.
2122 (cl-case bkw 2181 (cond
2123 ((:active :enable :label :visible :suffix :selected) (elisp-scope-1 (cadr it))) 2182 ((eq (elisp-scope-sym-bare (car-safe q)) 'menu-item)
2124 ((:filter) (elisp-scope-sharpquote (cadr it)))) 2183 (let ((fn (caddr q)) (it (cdddr q)))
2125 (setq it (cddr it))))) 2184 (elisp-scope-sharpquote fn)
2126 ((or (symbolp q) (symbol-with-pos-p q)) 2185 (while-let ((kw (car-safe it))
2127 (elisp-scope-report-s q 'function))))) 2186 (bkw (elisp-scope-sym-bare kw))
2187 ((keywordp bkw)))
2188 (elisp-scope-report-s kw 'constant)
2189 (cl-case bkw
2190 ((:active :enable :label :visible :suffix :selected) (elisp-scope-1 (cadr it)))
2191 ((:filter) (elisp-scope-sharpquote (cadr it))))
2192 (setq it (cddr it)))))
2193 ((or (symbolp q) (symbol-with-pos-p q))
2194 (elisp-scope-report-s q 'function)))
2195 (elisp-scope-1 def))
2196 (elisp-scope-1 remove))
2128 2197
2129(elisp-scope-define-function-analyzer eval-after-load (&optional file form) 2198(elisp-scope-define-function-analyzer eval-after-load (&optional file form)
2130 (when-let* ((q (elisp-scope--unquote file))) (elisp-scope-report-s q 'feature)) 2199 (elisp-scope-1 file '(symbol . feature))
2131 (when-let* ((q (elisp-scope--unquote form))) (elisp-scope-1 q))) 2200 (elisp-scope-1 form 'code))
2132 2201
2133(elisp-scope-define-macro-analyzer define-globalized-minor-mode (global mode turn-on &rest body) 2202(elisp-scope-define-macro-analyzer define-globalized-minor-mode (global mode turn-on &rest body)
2134 (elisp-scope-report-s mode 'function) 2203 (elisp-scope-report-s mode 'function)
@@ -2520,12 +2589,15 @@ trusted code macro expansion is always safe."
2520 2589
2521(cl-defgeneric elisp-scope--match-type-to-arg (type arg)) 2590(cl-defgeneric elisp-scope--match-type-to-arg (type arg))
2522 2591
2592(cl-defmethod elisp-scope--match-type-to-arg ((type (eql t)) _arg) type)
2593
2523(cl-defmethod elisp-scope--match-type-to-arg ((type (eql 'code)) _arg) type) 2594(cl-defmethod elisp-scope--match-type-to-arg ((type (eql 'code)) _arg) type)
2524 2595
2525(cl-defmethod elisp-scope--match-type-to-arg ((_type (eql 'type)) arg) 2596(cl-defmethod elisp-scope--match-type-to-arg ((_type (eql 'type)) arg)
2526 (elisp-scope--match-type-to-arg 2597 (elisp-scope--match-type-to-arg
2527 ;; Unfold `type'. 2598 ;; Unfold `type'.
2528 '(or (equal . code) 2599 '(or (equal . t)
2600 (equal . code)
2529 (equal . type) 2601 (equal . type)
2530 (cons (equal . symbol) . (symbol . symbol-type)) 2602 (cons (equal . symbol) . (symbol . symbol-type))
2531 (cons (equal . repeat) . type) 2603 (cons (equal . repeat) . type)
@@ -2560,12 +2632,7 @@ trusted code macro expansion is always safe."
2560 (cons 'cons (cons car-res cdr-res)))))) 2632 (cons 'cons (cons car-res cdr-res))))))
2561 2633
2562(cl-defmethod elisp-scope--match-type-to-arg ((type (head equal)) arg) 2634(cl-defmethod elisp-scope--match-type-to-arg ((type (head equal)) arg)
2563 (equal (cdr type) arg)) 2635 (let ((symbols-with-pos-enabled t)) (equal (cdr type) arg)))
2564
2565(elisp-scope--match-type-to-arg '(repeat .
2566 (or (cons (equal . foo) . (symbol footype))
2567 (cons (equal . bar) . (symbol bartype))))
2568 '((bar . spambar) (foo . spamfoo)))
2569 2636
2570(elisp-scope-define-special-form-analyzer catch (&optional tag &rest body) 2637(elisp-scope-define-special-form-analyzer catch (&optional tag &rest body)
2571 (elisp-scope-1 tag '(symbol . throw-tag)) 2638 (elisp-scope-1 tag '(symbol . throw-tag))
@@ -2617,7 +2684,7 @@ trusted code macro expansion is always safe."
2617 ((special-form-p bare) (elisp-scope-report-s f 'special-form) (elisp-scope-n forms)) 2684 ((special-form-p bare) (elisp-scope-report-s f 'special-form) (elisp-scope-n forms))
2618 ((macrop bare) (elisp-scope-report-s f 'macro) 2685 ((macrop bare) (elisp-scope-report-s f 'macro)
2619 (cond 2686 (cond
2620 ((eq (get bare 'edebug-form-spec) t) (elisp-scope-n forms)) 2687 ;; ((eq (get bare 'edebug-form-spec) t) (elisp-scope-n forms))
2621 ((elisp-scope-safe-macro-p bare) 2688 ((elisp-scope-safe-macro-p bare)
2622 (let* ((warning-minimum-log-level :emergency) 2689 (let* ((warning-minimum-log-level :emergency)
2623 (macroexp-inhibit-compiler-macros t) 2690 (macroexp-inhibit-compiler-macros t)
@@ -2627,7 +2694,7 @@ trusted code macro expansion is always safe."
2627 (macroexpand-all-environment 2694 (macroexpand-all-environment
2628 (append (mapcar #'list elisp-scope-unsafe-macros) macroexpand-all-environment)) 2695 (append (mapcar #'list elisp-scope-unsafe-macros) macroexpand-all-environment))
2629 (expanded (ignore-errors (macroexpand-1 form macroexpand-all-environment)))) 2696 (expanded (ignore-errors (macroexpand-1 form macroexpand-all-environment))))
2630 (elisp-scope-1 expanded))))) 2697 (elisp-scope-1 expanded outtype)))))
2631 ((or (functionp bare) (memq bare elisp-scope-local-functions)) 2698 ((or (functionp bare) (memq bare elisp-scope-local-functions))
2632 (elisp-scope-report-s f 'function) (elisp-scope-n forms)) 2699 (elisp-scope-report-s f 'function) (elisp-scope-n forms))
2633 (t 2700 (t