]> git.eshelyaron.com Git - emacs.git/commitdiff
scope.el: Recognize a few more widgets
authorEshel Yaron <me@eshelyaron.com>
Mon, 20 Jan 2025 07:54:05 +0000 (08:54 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 20 Jan 2025 07:54:05 +0000 (08:54 +0100)
lisp/emacs-lisp/scope.el

index 4d165d65e0945eb4ab295a32d872c04fc24ac79c..e1e958966e3d59b889fa7c7bdc30aaf669ecce11 100644 (file)
@@ -678,7 +678,9 @@ Optional argument LOCAL is a local context to extend."
     (when-let* ((fun (car args))
                 (beg (scope-sym-pos fun))
                 (bare (scope-sym-bare fun)))
-      (funcall scope-callback 'function beg (length (symbol-name bare)) nil))))
+      (funcall scope-callback 'function beg (length (symbol-name bare)) nil)))
+   ((memq kw '(:args))
+    (mapc #'scope-widget-type-1 (car args))))
   ;; TODO: (restricted-sexp :match-alternatives CRITERIA)
   (scope-widget-type-arguments head (cdr args)))
 
@@ -691,7 +693,8 @@ Optional argument LOCAL is a local context to extend."
 
 (defun scope-widget-type-arguments-1 (head args)
   (cl-case head
-    ((list cons group vector choice radio set repeat) (mapc #'scope-widget-type-1 args))
+    ((list cons group vector choice radio set repeat checklist)
+     (mapc #'scope-widget-type-1 args))
     ((function-item)
      (when-let* ((fun (car args))
                  (beg (scope-sym-pos fun))
@@ -880,7 +883,16 @@ a (possibly empty) list of safe macros.")
                          (prnt (cadr prnt-form))
                          (beg (scope-sym-pos prnt))
                          (bare (scope-sym-bare prnt)))
-               (funcall scope-callback 'widget-type beg (length (symbol-name bare)) nil)))
+               (funcall scope-callback 'widget-type beg (length (symbol-name bare)) nil))
+             (when-let* ((props (cdddr forms))
+                         (symbols-with-pos-enabled t))
+               (when-let ((val-form (plist-get props :type)))
+                 (scope-widget-type local val-form))
+               (when-let ((val-form (plist-get props :args))
+                          ((memq (scope-sym-bare (car-safe val-form)) '(quote \`)))
+                          (val (cadr val-form))
+                          ((consp val)))
+                 (mapc #'scope-widget-type-1 val))))
             ((define-error)
              (when-let* ((name-form (car forms))
                          ((memq (scope-sym-bare (car-safe name-form)) '(quote \`)))