Giter VIP home page Giter VIP logo

Comments (10)

purcell avatar purcell commented on May 27, 2024

Sorry, I didn't quite understand what's wrong here. How would I reproduce this?

from emacs.d.

xiliuya avatar xiliuya commented on May 27, 2024

Sorry, I didn't quite understand what's wrong here. How would I reproduce this?

I added the configuration in init-local.el.
(add-hook 'c-mode-common-hook 'eglot-ensure)
Then close all the c files, restart emacs, open C file will pop up this error.

from emacs.d.

xiliuya avatar xiliuya commented on May 27, 2024

Sorry, I didn't quite understand what's wrong here. How would I reproduce this?

Is my configuration incorrect?
But even if I don't use eglot. If I don't comment out the above lines (flymake-flycheck).
Opening the c project *Flymake diagnostic gives an error similar to the following:
The test project is xv6-riscv

1 9 error ( 'kernel/types.h' file not found [c/c++-clang]

from emacs.d.

xiliuya avatar xiliuya commented on May 27, 2024

Sorry, I didn't quite understand what's wrong here. How would I reproduce this?

I found that the value of flymake-diagnostic-functions is different
flymake-check does not open:

Its value is (eglot-flymake-backend)

When flymake-check is on:

Its value is
(eglot-flymake-backend #f(compiled-function
                          (report-fn &rest _)
                          #<bytecode 0x5319205130afeb4>))

from emacs.d.

purcell avatar purcell commented on May 27, 2024

Yeah, I guess it's possible that if some flycheck backends are enabled, then they will be used via flymake-flycheck alongside eglot. I'll have a think about how to tackle this. In the meantime you can probably add unwanted flycheck backends to flycheck-disabled-checkers.

from emacs.d.

xiliuya avatar xiliuya commented on May 27, 2024

Yeah, I guess it's possible that if some flycheck backends are enabled, then they will be used via flymake-flycheck alongside eglot. I'll have a think about how to tackle this. In the meantime you can probably add unwanted flycheck backends to flycheck-disabled-checkers.

It's very effective. Thank you for your help.

 (setq-default flycheck-disabled-checkers
                  (append (default-value 'flycheck-disabled-checkers)
                          '(c/c++-clang c/c++-gcc c/c++-cppcheck)))

from emacs.d.

purcell avatar purcell commented on May 27, 2024

Thanks for confirming that this helped you!

from emacs.d.

yszhang95 avatar yszhang95 commented on May 27, 2024

I also want to disable c/c++-clang and enable eglot-flymake-backend. I tried to put in init-local.el

(with-eval-after-load 'flycheck (add-to-list 'flycheck-disabled-checkers 'c/c++-clang))

as suggested in the link.

However, it does not work unless I delete (add-hook 'flymake-mode-hook 'flymake-flycheck-auto) in init-flymake.el and add it after (add-to-list 'flycheck-disabled-checkers 'c/c++-clang) in init-local.el.

I wonder if there is any way to reconcile without modifying anything in init-flymake.el. I want to keep things synchronized with you and avoid corruption from my changes.

Another things is that after I disable c/c++-clang in a dirty way, the backend eglot-flymake-backend cannot be enabled automatically. Executing M-x flymake-running-backends gives me nothing. I have to execute M-X eglot in the buffer manually and eglot checker got invoked. Is there suggestions to overcome this step and make things consistent with flymake-flycheck?

Many thanks!

Edited: It is not necessary to invoke

(add-hook 'flymake-diagnostics-functions 'eglot-flymake-backend nil t)

instead, I have to do

(add-hook 'c++-ts-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)

from emacs.d.

purcell avatar purcell commented on May 27, 2024

@yszhang95 Thanks for the info. What do you mean by "the backend eglot-flymake-backend cannot be enabled automatically"? Do you mean when eglot is active in a project, and you open a new buffer, for example? I'm interested in how to reproduce this issue step-by-step specifically, because I'd like to fix it.

from emacs.d.

yszhang95 avatar yszhang95 commented on May 27, 2024

Thank you for the quick reply @purcell !

When I tried to prepare for a minimal example to reproduce, I found I have to include

(add-hook 'c++-ts-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)

Sorry for the misleading question. I will update my last comment to avoid misleading others.

The remaining question is the first one, how to avoid corrupting your setup.

Best regards!

from emacs.d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.