Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Keyword argument :label not one of (:key :children :child-type)" when enabling dap-mode #825

Open
Gleek opened this issue Feb 5, 2025 · 9 comments · May be fixed by #829
Open

Error "Keyword argument :label not one of (:key :children :child-type)" when enabling dap-mode #825

Gleek opened this issue Feb 5, 2025 · 9 comments · May be fixed by #829

Comments

@Gleek
Copy link

Gleek commented Feb 5, 2025

Following is the stack trace I get whenever I'm enabling dap-mode

Debugger entered--Lisp error: (error "Keyword argument :label not one of (:key :children :child-type)")
  error("Keyword argument %s not one of (:key :children :child-type)" :label)
  (cond ((memq (car --cl-keys--) '(:key :children :child-type :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--))))
  (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:key :children :child-type :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--)))))
  (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:key :children :child-type :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--))))))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:key :children :child-type :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--)))))) (progn (if key nil (error (apply #'format (concat "[Treemacs] " ":key parameter is mandatory") (list)))) (if children nil (error (apply #'format (concat "[Treemacs] " ":childen parameter is mandatory") (list)))) (if child-type nil (error (apply #'format (concat "[Treemacs] " ":child-type parameter is mandatory") (list)))) (cons 'treemacs-do-define-extension-type (cons name (cons ':open-icon (cons "" (cons ':key (cons key (cons ':closed-icon (cons "" (cons ':children (cons children (cons ':child-type (cons child-type '(:variadic? t :entry-point? t)))))))))))))))
  (let* ((key (car (cdr (plist-member --cl-rest-- ':key)))) (children (car (cdr (plist-member --cl-rest-- ':children)))) (child-type (car (cdr (plist-member --cl-rest-- ':child-type))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '...) (if (cdr --cl-keys--) nil (error "Missing argument for %s" ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--)))))) (progn (if key nil (error (apply #'format (concat "[Treemacs] " ":key parameter is mandatory") (list)))) (if children nil (error (apply #'format (concat "[Treemacs] " ":childen parameter is mandatory") (list)))) (if child-type nil (error (apply #'format (concat "[Treemacs] " ":child-type parameter is mandatory") (list)))) (cons 'treemacs-do-define-extension-type (cons name (cons ':open-icon (cons "" (cons ':key (cons key (cons ':closed-icon (cons "" (cons ':children (cons children (cons ':child-type (cons child-type '(:variadic? t :entry-point? t))))))))))))))))
  #f(lambda (name &rest --cl-rest--) [cl-struct-treemacs-extension-tags t] "Define a node type that serves as an entry-point for a variadic extension.\n'Variadic' means that the extension will produce multiple nodes when it is first\nrendered instead of just one (e.g. a single 'Buffer List' node vs multiple nodes\neach grouping buffers by major mode).\n\nThe NAME symbol can be passed to `treemacs-initialize' to render this extension\nin a buffer.\n\nThe KEY, CHILDREN and CHILD-TYPE arguments are mandatory.\n\nFor a detailed description of all arguments see\n`treemacs-do-define-extension-type'.\n\n(fn NAME &key KEY CHILDREN CHILD-TYPE)" (let* ((key (car (cdr (plist-member --cl-rest-- ':key)))) (children (car (cdr (plist-member --cl-rest-- ':children)))) (child-type (car (cdr (plist-member --cl-rest-- ':child-type))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:key :children :child-type :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:key :children :child-type)" (car --cl-keys--)))))) (progn (if key nil (error (apply #'format (concat "[Treemacs] " ":key parameter is mandatory") (list)))) (if children nil (error (apply #'format (concat "[Treemacs] " ":childen parameter is mandatory") (list)))) (if child-type nil (error (apply #'format (concat "[Treemacs] " ":child-type parameter is mandatory") (list)))) (cons 'treemacs-do-define-extension-type (cons name (cons ':open-icon (cons "" (cons ':key (cons key (cons ':closed-icon (cons "" (cons ':children (cons children (cons ':child-type (cons child-type '(:variadic? t :entry-point? t)))))))))))))))))(dap-loaded-sources :key 'DAP-Loaded-Sources :label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face) :open-icon (dap-ui--calculate-sources-icon item t) :closed-icon (dap-ui--calculate-sources-icon item nil) :children (dap-ui--loaded-sources-root) :child-type 'dap-loaded-sources-node :more-properties `(:pth ,item))
  macroexpand((treemacs-define-variadic-entry-node-type dap-loaded-sources :key 'DAP-Loaded-Sources :label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face) :open-icon (dap-ui--calculate-sources-icon item t) :closed-icon (dap-ui--calculate-sources-icon item nil) :children (dap-ui--loaded-sources-root) :child-type 'dap-loaded-sources-node :more-properties `(:pth ,item)))
  internal-macroexpand-for-load((treemacs-define-variadic-entry-node-type dap-loaded-sources :key 'DAP-Loaded-Sources :label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face) :open-icon (dap-ui--calculate-sources-icon item t) :closed-icon (dap-ui--calculate-sources-icon item nil) :children (dap-ui--loaded-sources-root) :child-type 'dap-loaded-sources-node :more-properties `(:pth ,item)) nil)
  load-with-code-conversion("/Users/umar/.config/emacs/elpaca/builds/dap-mode/dap-ui.el" "/Users/umar/.config/emacs/elpaca/builds/dap-mode/dap-ui.el" nil t)
  dap-ui-mode()
  run-hooks(dap-mode-hook dap-mode-on-hook)
  apply(run-hooks (dap-mode-hook dap-mode-on-hook))
  dap-mode(toggle)

M-x lsp-version
LSP :: lsp-mode 20240422.334, Emacs 30.0.93, darwin

I'm on the current master branch of dap-mode

@4honor
Copy link

4honor commented Feb 8, 2025

Me two. dap-mode 0.8 works!

I also get:

internal-macroexpand-for-load: Eager macro-expansion skipped due to cycle:
… => (load "dap-ui.el") => (macroexpand-all (treemacs-define-variadic-entry-node-type dap-loaded-sources …)) => (macroexpand (treemacs-define-variadic-entry-node-type …)) => (load "dap-mouse.el") => (load "dap-ui.el")

  • GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.4.0, NS appkit-2487.50 Version 14.4.1 (Build 23E224)) of 2024-10-16
  • dap-mode-20250131.1624
  • lsp-mode-20250203.2137
  • lsp-java-20240524.2207

@thanhvg
Copy link

thanhvg commented Feb 15, 2025

I don't use dap-mode/dap-ui but lsp-mode calls dap by default so I got this error too. Looks like the use of treemacs-define-variadic-entry-node-type macro is the problem (https://github.com/emacs-lsp/dap-mode/blob/master/dap-ui.el#L1173), it should be treemacs-define-expandable-node-type instead.

modified   dap-ui.el
@@ -1170,7 +1170,7 @@ request."
               (dap-ui--sources-group-by-map #'cl-first #'cl-rest)
               (-sort 'dap-ui--compare-source)))))))
 
-(treemacs-define-variadic-entry-node-type dap-loaded-sources
+(treemacs-define-expandable-node-type dap-loaded-sources
   :key 'DAP-Loaded-Sources
   :label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face)
   :open-icon (dap-ui--calculate-sources-icon item t)

This change was introduced a couple of weeks ago #824, perhaps the author of the change @timfel could help.

@timfel
Copy link
Contributor

timfel commented Feb 15, 2025

I don't use dap-mode/dap-ui but lsp-mode calls dap by default so I got this error too. Looks like the use of treemacs-define-variadic-entry-node-type macro is the problem (https://github.com/emacs-lsp/dap-mode/blob/master/dap-ui.el#L1173), it should be treemacs-define-expandable-node-type instead.

modified dap-ui.el
@@ -1170,7 +1170,7 @@ request."
(dap-ui--sources-group-by-map #'cl-first #'cl-rest)
(-sort 'dap-ui--compare-source)))))))

-(treemacs-define-variadic-entry-node-type dap-loaded-sources
+(treemacs-define-expandable-node-type dap-loaded-sources
:key 'DAP-Loaded-Sources
:label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face)
:open-icon (dap-ui--calculate-sources-icon item t)
This change was introduced a couple of weeks ago #824, perhaps the author of the change @timfel could help.

No, define-variadic-entry-node-type is correct, see https://github.com/Alexander-Miller/treemacs/blob/master/Extensions.org#variadic-nodes-and-non-treemacs-buffers

@timfel
Copy link
Contributor

timfel commented Feb 15, 2025

It's possible the treemacs version is too old

@Gleek
Copy link
Author

Gleek commented Feb 16, 2025

It's possible the treemacs version is too old

Not for me! I'm on latest treemacs as well.

M-x treemacs-version
[Treemacs] v3.1 (installed 2025.02.12) @ Emacs 30.0.93)

@timfel
Copy link
Contributor

timfel commented Feb 16, 2025

@Gleek could you try this change?

@@ -1172,12 +1172,8 @@ request."
 
 (treemacs-define-variadic-entry-node-type dap-loaded-sources
   :key 'DAP-Loaded-Sources
-  :label (propertize "DAP-Loaded-Sources" 'face 'font-lock-keyword-face)
-  :open-icon (dap-ui--calculate-sources-icon item t)
-  :closed-icon (dap-ui--calculate-sources-icon item nil)
   :children (dap-ui--loaded-sources-root)
-  :child-type 'dap-loaded-sources-node
-  :more-properties `(:pth ,item))
+  :child-type 'dap-loaded-sources-node)
 
 (treemacs-define-expandable-node-type dap-loaded-sources-node
   :open-icon (dap-ui--calculate-sources-icon item t)

@Gleek
Copy link
Author

Gleek commented Feb 17, 2025

@timfel this solves it. The error doesn't happen.

@timfel
Copy link
Contributor

timfel commented Feb 17, 2025

@timfel this solves it. The error doesn't happen.

Would you like to open a PR? :-)

@Gleek
Copy link
Author

Gleek commented Feb 17, 2025

With these exact changes? Here you go: #829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants