cannot open a file when a long flycheck message is displayed #648
Comments
@soonhokong Please reproduce this issue in a clean Emacs session with I mean no offense, but much of what you do in this library is wrong or broken or both, to a degree that if you had opened this issue with a lean file as example I'd have closed it right away without further investigation as upstream bug. Specifically:
Please excuse my rather harsh tone, but I feel a little frustrated to see such blatant mistakes that is prone to cause issues for users of my library, and that could have easily been avoided by reading the documentation and the code of Flycheck (there are comprehensive docstrings, and a lot of built-in syntax checkers to serve as examples), or by simply asking me. I urge you to fix these issues. As long as your code is in this shape, you are on your own: I'll refuse to fix, or even care for, any Flycheck issues reported in relation to Lean Mode. |
@soonhokong Following your instructions, I failed to reproduce this issue in Emacs 24.5 and 25.1, using clean |
@lunaryorn, thanks for the suggestions for
I can confirm that I can't reproduce the problem with |
I might be able to help with this if you could show me a backtrace for this error. You can obtain one by enabling debugging with |
@lunaryorn, I really appreciate your comments and suggestions. I understand your concerns and frustrations because sometimes I have similar feelings when I work on my own open-source projects. As you may notice, I've made two commits to fix the two issues that you pointed out:
For the following items, I have some excuses. If you still think that they are unreasonable, please let me know. I'm really happy to know.
When a Lean file is compiled, it generates some auxiliary files such as (
We try to detect the current buffer-width of flycheck-error window and send it to Lean so that the error messages can be pretty-printed (hopefully) in a better shape. |
@soonhokong Sorry, I meant Please also remove And finally please consider removing With regards to temporary files: Flycheck provides no feature to remove auxiliary temporary files, because it has no chance to detect these. However, letting the checker generate arbitrary files is the wrong approach in my opinion. Is there no option to tell lean to omit the generation of these files, or at least write them to some other directory? In that case, you could use the |
@lunaryorn, thanks for suggestions. I'll definitely do another round of clean-up soon by following your suggestions. |
By the way, I found a way to reproduce the problem for which I opened this issue. I made sure that it can be reproduced with
I can reproduce it on my mac (OSX 10.10 + emacs-24.4) and Linux machine (Ubuntu-12.04 + emacs-24.3). |
I'll take look then. Reopening. |
@soonhokong I've tried but I failed to reproduce in Emacs 25.1, with If you still see this issue, please follow my advice from above, and enable the debugger to obtain a backtrace. Please paste the resulting backtrace in a comment. |
@soonhokong Closing due to inactivity. If you can provide a traceback of this error please add a comment, and I'll reopen the issue. |
@lunaryorn, sorry for the very late response. I just tried to reproduce the issue again, and was able to reproduce it. Here is my environment:
Here is the screencast that I recorded. I also notice that it requires a smaller terminal width to reproduce the problem. I hope this helps. |
Hi @soonhokong. I had a look at this, but I can't reproduce it either (on Linux Mint). Could you maybe use |
It doesn't trigger the debugger. It gives nothing to the |
I'm happy to share a digital ocean VM where I installed Ubuntu-14.04 + emacs-25-1.50.2 + flycheck (20151212). If you want this, please send me an email (soonhok at cs/cmu/edu) |
One observation: please make sure that you don't have |
@soonhokong I don't think a VM will help us. I'd rather prefer if you could compile a recipe to reproduce this issue in This would allow us to reproduce the issue in our own Emacs setup, and it would rule out your Emacs configuration as a factor. |
I'm sure that my emacs configuration is not a factor, because I can reproduce it in a fresh VM. I only added MELPA to install flycheck, nothing else.
OK. Here it is:
Here is the screencast that I mentioned above. |
@soonhokong Ah, sorry, I hadn't seen that the screencast actually implied You've also said that the problem requires a “smaller terminal width”. Can you define that more precisely, i.e. give a number of columns and rows the terminal should have? |
@soonhokong Oh, I'm indeed able to reproduce the issue with your recipe. I don't know why I failed to reproduce it initially; I'm sorry to have bothered you with pointless comments and stupid questions. I should have tried harder to reproduce. Sorry. I'm not sure where the problem comes from. I've tried a couple of things while the error shows with
but none of these enabled me to successfully switch to I'll try to step through this issue with a mixture of edebug, debug-on-entry and debug-on-quit, hoping that I'll be able to isolate the cause, but that'll be a somewhat longer task and it'll take a while until I'll be able to save some time for this issue. The days before Christmas are just too busy for me I know that you've waited for a long time already, but I'm afraid I have to ask you to still be patient and wait for us to fix this issue. Unless someone else comes up with a fix, it'll likely take quite some time before we are able to isolate and fix the issue. I'm sorry. A patch or a pull request, or any piece of information however small that helps us to identify the cause of this issue would be awesome |
@lunaryorn, Great! Thanks for all the efforts. I really appreciate.
I totally understand. Please take your time and make a comment here if you find anything.
I'll try to investigate it on my side as well. |
@soonhokong Thanks for your perseverance. Indeed, I can reproduce this too. Yay! @soonhokong, @lunaryorn I think I know what's going on. Here's a quick summary: Opening Now here's the documentation of
The import part is In more details, the whole sequence of calls happens inside a (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
(with-current-buffer buf
...
(after-find-file error (not nowarn))
(current-buffer))) Thus everything in Since |
Btw, the reason this happens only once and the second call to |
Here's a patch that fixes the issue for me: @@ -4141,7 +4141,8 @@ Hide the error buffer if there is no error under point."
(-when-let* ((buffer (flycheck-error-message-buffer))
(window (get-buffer-window buffer)))
(unless (flycheck-overlays-at (point))
- (quit-window nil window))))
+ (save-selected-window
+ (quit-window nil window))))) I have no idea whether that's actually what we want to do, though. @soonhokong, could you maybe try it? The simplest way would be to add this to the end of your minimal example and run it again. (defun flycheck-hide-error-buffer ()
"Hide the Flycheck error buffer if necessary.
Hide the error buffer if there is no error under point."
(-when-let* ((buffer (flycheck-error-message-buffer))
(window (get-buffer-window buffer)))
(unless (flycheck-overlays-at (point))
(save-selected-window
(quit-window nil window))))) |
@cpitclaudel, it works!!! |
Great news. I'll be happy to have @lunaryorn's opinion on this fix; window configurations are not my speciality at all. Thanks a lot for reporting this bug; it was a pretty tricky one. |
@cpitclaudel Jesus, what a mess. Thank you soooo much for diving head first into this and coming out with a great solution I think that your fix is sound, please feel free to push it to |
@soonhokong Thank you for pushing us through this bug, and for your patience! |
@lunaryorn and @cpitclaudel, thanks a lot for paying attention to this issue. I appreciate all the efforts! |
Env: Ubuntu-12.04 + GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2015-12-13 * Start emacs with "-q" option * Load the prepared script ( available%20at%20flycheck/flycheck#648 (comment) ) * Open test1.txt, put the cursor at line 1, column 1. * Find-file test2.txt. It doesn't work. * Try again to find-file test2.txt. It works this time. Note: At step 4, emacs actually opens the test2.file, but it doesn't switch to the buffer.
Reproduce Steps
Set up an example checker for text-mode:
Open a text file, turn on flycheck-mode. Place cursor on the first line, it shows the long flycheck error message.

Open a CPP file (test.cpp) via

find-file
.Bug
It does not show the opened
test.cpp
file with an error message"Buffer test.txt is not a CC Mode buffer (c-set-style)"
. Note that the filetest.cpp
is added to the buffer list. If we run thefind-file
command again, it shows the file.It shows the same problem when I try to open a file where flycheck-mode is enabled. Manually disabling flycheck-mode for a certain type of files resolves the issue. It seems there is a conflict between showing a long flycheck message and opening another buffer and enabling flycheck-mode for that buffer.
Env
I have team members who reported me the same issue. They're using Ubuntu-12.04 and Emacs 24.4.
The text was updated successfully, but these errors were encountered: