[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17330: files.el cd-absolute overcome false negative from file-execut
From: |
Stefan Monnier |
Subject: |
bug#17330: files.el cd-absolute overcome false negative from file-executable-p |
Date: |
Tue, 06 May 2014 08:46:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> After discovering that even C functions can be redefined, today I "activated
> an advice" so that all file-executable-p C code calls from Lisp return t.
> No unexpected refusals, no noticeable downsides, no waiting months for
> C code changes to appear in a new official release.
The changes being discussed are to `cd-absolute' which is an Elisp
function, so no need for recompilation.
E.g. if you add
(defun cd-absolute (dir)
"Change current directory to given absolute file name DIR."
;; Put the name into directory syntax now,
;; because otherwise expand-file-name may give some bad results.
(setq dir (file-name-as-directory dir))
;; We used to additionally call abbreviate-file-name here, for an
;; unknown reason. Problem is that most buffers are setup
;; without going through cd-absolute and don't call
;; abbreviate-file-name on their default-directory, so the few that
;; do end up using a superficially different directory.
(setq dir (expand-file-name dir))
(if (not (file-directory-p dir))
(if (file-exists-p dir)
(error "%s is not a directory" dir)
(error "%s: no such directory" dir))
(unless (file-accessible-directory-p dir)
(error "Cannot cd to %s: Permission denied" dir))
(setq default-directory dir)
(setq list-buffers-directory dir)))
to your .emacs, does it fix the problem for you?
Stefan