-
Notifications
You must be signed in to change notification settings - Fork 97
irony-cdb-autosetup-compile-options
not called by irony-mode-hook
#195
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
Comments
For some reason it seems like the hook isn't called, I don't know why just yet. What Emacs version do you have? |
Okay, the hook isn't called at home for me (Emacs 24.5.1) but it is at work (older version). Be careful in your configuration:
I'm not sure if duplicates are cleaned up properly, I will have to take a look but I plan on changing irony-cdb a bit. |
Yeah, I had a |
I checked, I'm using |
I was wrong, even with Emacs 24.5.1 it works for me, I wasn't on master and I had some weird configuration (to test what I'm working on) but once the configuration restored it works fine. After looking at your configuration more carefully I'm wondering if you could try to replace the following in your configuration: ;; Add "../build" (relative to the projectile root directory) of Cxx projects
;; as the path where to find "compile_commands.json", then load irony's options.
(defun my-load-irony-options()
(irony-cdb-json-add-compile-commands-path (projectile-project-root)
(concat (file-name-as-directory "build")
"compile_commands.json"))
(irony-cdb-autosetup-compile-options))
;; Reload and apply the Clang flags each time an irony buffer is opened
;; FIXME: the json's dir gets added every time, but the list never gets reset...
;; FIXME: this should run on 'irony-mode-hook, but it does not seem to work
;(add-hook 'irony-mode-hook 'my-load-irony-options)
(add-hook 'c-mode-hook 'my-load-irony-options)
(add-hook 'c++-mode-hook 'my-load-irony-options)
(add-hook 'objc-mode-hook 'my-load-irony-options) By this: (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) Then you can call Can you tell me if this work? I'm not sure it's safe to call the projectile function in irony mode hook, how can you guarantee the order of initialization of the minor mode? If for some reasons something in projectile errors when projectile isn't yet initialized, |
I tried removing the custom callback and calling Irony now doesn't seem to load |
Can you try that: #190 (comment) |
Sure. Output before adding
After adding
|
I've setup irony with a
.clang_completer
file, and I have the following run by Emacs at startup:If I open a c-mode buffer, though, M-x
irony-cdb-menu
shows that no completion database is loaded the first time, even thoughirony-mode
is enabled and, as such,irony-mode-hook
should have run already. M-xdescribe-variable
irony-mode-hook
seems to be correct, since all of the three callbacks defined in the config snipped above seem to be present.Running
irony-cdb-autosetup-compile-options
(and restarting FlyCheck to refresh the error list) by hand seems to fix this issue.The text was updated successfully, but these errors were encountered: