Fix #1507 (allow Emacs Lisp checker to run without a buffer-file-name)#1695
Fix #1507 (allow Emacs Lisp checker to run without a buffer-file-name)#1695cpitclaudel merged 1 commit intomasterfrom
Conversation
3d57ecb to
3b1d955
Compare
|
Thank you so much @cpitclaudel! What workflow would you recommend for me, who has a literate init file with many source blocks? When I use |
It's quite tricky. Your description is exactly right. Ideally, you'd want org to create an indirect buffer that has all your snippets in it, and narrow it to the snippet you're editing. Then Flycheck and Emacs would see the whole context. Is there a generic way (in org-mode) to extract all snippets that a snippet depends on? |
3b1d955 to
33f2b01
Compare
|
I've updated the PR to make it more robust. Can you give it a new try and tell me if it still gives you errors (the update won't improve things in terms of spurious errors) |
Well there's tangling. If I jump to definition (
Confirmed, still works on 33f2b01. |
Right. Ideally, that temporary buffer that org gives you should be the full tangled file, narrowed to just the snippet that you're editing. That's a discussion that would be better taken to the org-mode list, though.
Thanks! |
Quite right. Never did figure out how to use it, to be honest. If only they had a status-based bug tracker… |
33f2b01 to
495992b
Compare
fmdkdd
left a comment
There was a problem hiding this comment.
LGTM, it's always good to be able to check buffers without files if we can.
This definitely warrants an entry in the changelog.
d5771e8 to
5d18e29
Compare
Closes GH-1507. This isn't perfect because org mode temporary buffers don't have a file name at all, so we don't know which buffer they came from. The original code said this: > Ensure that we only check buffers with a backing file. For buffers > without a backing file we cannot guarantee that file names in error > messages are properly resolved, because `byte-compile-file' emits file > names *relative to the directory of the checked file* instead of the > working directory. Hence our backwards-substitution will fail, because > the checker process has a different base directory to resolve relative > file names than the Flycheck code working on the buffer to check. The problem is that we create a temp file in /tmp/, and the checker reports errors relative to that, so we get "xyz" as a file name. This doesn't match what we expect ($PWD/xyz). The fix here is to tell the ELisp compiler which directory to report errors relative to.
5d18e29 to
b7d2f99
Compare
CC @matthew-piziak
Closes GH-1507. This isn't perfect because org mode temporary buffers don't
have a file name at all, so we don't know which buffer they came from.
The original code said this:
The problem is that we create a temp file in /tmp/, and the checker reports
errors relative to that, so we get "xyz" as a file name. This doesn't match
what we expect (
$PWD/xyz). The fix here is to tell the ELisp compiler whichdirectory to report errors relative to.