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

Eager macro-expansion failure: (wrong-number-of-arguments (1 . 1) 0) when (require 'dap-ui) #120 #673

Open
zw963 opened this issue Oct 6, 2022 · 12 comments

Comments

@zw963
Copy link

zw963 commented Oct 6, 2022

This is not a error, just a warning when start emacs daemon.

Thanks

@yyoncho
Copy link
Member

yyoncho commented Oct 6, 2022

Please test with M-x lsp-start-plain

@jcs090218
Copy link
Member

Looks similar to emacs-lsp/lsp-metals#81. I think the issue is from the upstream treemacs.

I have reported the issue in Alexander-Miller/treemacs#982.

@zw963
Copy link
Author

zw963 commented Oct 6, 2022

I can reproduce use following minimum:

(require 'dap-mouse)
(require 'dapui)

Both of them required to output this error, although, treemacs really in the load path, it many be load automatically.

@zw963
Copy link
Author

zw963 commented Oct 6, 2022

I can't reproduce it if (require 'treemacs) and (require 'lsp-treemacs).

@jcs090218
Copy link
Member

Do you have lsp-mentals installed? I think it get triggered only when you activated/executed.

@zw963
Copy link
Author

zw963 commented Oct 6, 2022

Do you have lsp-mentals installed? I think it get triggered only when you activated/executed.

No, i use newest master of lsp-mode and dap-mode, none of them exists lsp-mentals.

@jcs090218
Copy link
Member

jcs090218 commented Oct 6, 2022

I can't reproduce it if (require 'treemacs) and (require 'lsp-treemacs).

I don't think requiring it will cause the Eager macro-expansion failure error.

No, i use newest master of lsp-mode and dap-mode, none of them exists lsp-mentals.

The error should come from this line

(treemacs-initialize)

It's the same bug I have posted in the previous #673 (comment).

@bertulli
Copy link

Please, forgive me if I missed something, but shouldn't the code of dapui-loaded-sources the one being fixed? For what I see, treemacs changed the interface to the treemacs-initialize function: can't dap-mode's code be modified to reflect this?

@yyoncho
Copy link
Member

yyoncho commented Nov 18, 2022

@bertulli yes, it should. I will comment it out for now.

@bertulli
Copy link

bertulli commented Nov 18, 2022

Thanks! Just a minor suggestion: it appears treemacs-initialize should be called with as argument the same :key given to treemacs-define-variadic-entry-node-type. Running a very noob-ish find-grep-dired in my ~/.emacs.d/ shows that treemacs-define-variadic-entry-node-type is only called in lsp-treemacs/lsp-treemacs-generic.el (tho maybe I have not installed every lsp-mode related package). So, a possible fix is to keep a variable with the list of :keys passed to that, and to invoke treemacs-initialize with that. For instance, something like

;; lsp-treemacs/lsp-treemacs-generic.el
(defvar treemacs-feature-list '()
  "List of `':key's given to `'treemacs-define-variadic-entry-node-type'.")

(treemacs-define-variadic-entry-node-type lsp-treemacs-generic-root
  :key 'lsp-treemacs-generic-root
  :children lsp-treemacs-tree
  :child-type 'lsp-treemacs-generic-node)

(add-to-list 'treemacs-feature-list 'lsp-treemacs-generic-root)

;; dap-mode/dapui.el
;;;###autoload
(defun dapui-loaded-sources ()
  (interactive)
  (let* ((buffer (get-buffer-create "*DAP Loaded Sources*"))
         (window (display-buffer-in-side-window buffer nil)))
    (select-window window)
    (set-window-dedicated-p window t)
    (mapc #'treemacs-initialize treemacs-feature-list)
    (setq-local treemacs-default-visit-action 'treemacs-RET-action)
    (treemacs-DAP-LOADED-SOURCES-extension)

    (add-hook 'dap-terminated-hook 'dapui-sources-refresh)
    (add-hook 'dap-session-changed-hook 'dapui-sources-refresh)
    (add-hook 'dap-loaded-sources-changed-hook 'dapui-sources-refresh)
    (add-hook 'kill-buffer-hook 'dapui--cleanup-sources-hook nil t)))

I am little more than a beginner, so please tak this salt-grained, but it seems to work on my machine (maybe?). Please also note that treemacs-DAP-LOADED-SOURCES-extension too seems not to be defined. Is it an error on my side?

@yyoncho
Copy link
Member

yyoncho commented Nov 18, 2022

I just commented the source of dapui.el. @bertulli it is not that simple, we should rework the extension code to use lsp-treemacs-generic it is structured in different way.

@bertulli
Copy link

Got it, thank you! 🙏

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

No branches or pull requests

4 participants