Open Gilwyad opened 11 years ago
I have the exact same problem, and it's really annoying. Anything new on this one?
After investigation, it seems that the problem came from my flymake + pyflakes init snippet. See https://github.com/ramnes/.emacs.d/commit/d47e2004739b780f7424a261fe195e6dadc33def.
Right, but still, there is a lot of Emacs code out there (including inside flymake.el
) that still calls
file-relative-name
in a way that exhibits this issue. Here is a workaround:
(defun with-noop-file-relative-name
(orig &rest init-args)
"Ensures that `file-relative-name' does nothing while calling ORIG."
(cl-letf (((symbol-function 'file-relative-name)
(lambda (orig-name &rest ignores) orig-name)))
(apply orig init-args)))
And then, advise every function such as php-flymake-php-init
that relies internally on file-relative-name
:
(eval-after-load "php-mode"
'(add-function :around (symbol-function 'php-flymake-php-init)
#'with-noop-file-relative-name))
Consider the following scenario:
~/projects/name/test.pl ~/shortcut -> ~/projects/name
If I open test.pl from projects/name, flymake works. However if I open it through the symbolic link "shortcut" then I get a "configuration error has occured... flymake will be switched off". Analyzing the log file, the problem is the temporary copy test_flymake.pl was not found! It was created correctly however:
At first look it seems the path is correct, but there is a problem. On Debian linux in bash, if I'm in a symbolic link that's pointing to a directory, cd .. takes me out of the "symbolic directory" (to where the symbolic link is), but executing a file with .. does not behave the same: it refers to the directory one level above the linked directory, NOT the symbolic link itself!
I would have too, expected
ls ..
to list the home directory, but it lists ~/projects instead, that's why the file is not found!