diff options
| author | Paul Eggert | 2020-08-26 10:53:32 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-08-26 13:27:56 -0700 |
| commit | ff864be694247e5f6c8732afcbaeb1c0a8a8a124 (patch) | |
| tree | a025eec8edb6c272e08c070907acf9880e55caca | |
| parent | dfeb0593128006e4cd1e47d831bf00bde9867437 (diff) | |
| download | emacs-ff864be694247e5f6c8732afcbaeb1c0a8a8a124.tar.gz emacs-ff864be694247e5f6c8732afcbaeb1c0a8a8a124.zip | |
Fix PWD startup checking with symlinks
* lisp/startup.el (normal-top-level): Do not put "." after "/";
it’s not needed and with current file-name-as-directory it does
the wrong thing if PWD is a symlink.
| -rw-r--r-- | lisp/startup.el | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index d9682eef4c8..48274830763 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -642,16 +642,13 @@ It is the default value of the variable `top-level'." | |||
| 642 | (list (default-value 'user-full-name))) | 642 | (list (default-value 'user-full-name))) |
| 643 | ;; If the PWD environment variable isn't accurate, delete it. | 643 | ;; If the PWD environment variable isn't accurate, delete it. |
| 644 | (let ((pwd (getenv "PWD"))) | 644 | (let ((pwd (getenv "PWD"))) |
| 645 | (and (stringp pwd) | 645 | (and pwd |
| 646 | ;; Use FOO/., so that if FOO is a symlink, file-attributes | ||
| 647 | ;; describes the directory linked to, not FOO itself. | ||
| 648 | (or (and default-directory | 646 | (or (and default-directory |
| 649 | (ignore-errors | 647 | (ignore-errors |
| 650 | (equal (file-attributes | 648 | (equal (file-attributes |
| 651 | (concat (file-name-as-directory pwd) ".")) | 649 | (file-name-as-directory pwd)) |
| 652 | (file-attributes | 650 | (file-attributes |
| 653 | (concat (file-name-as-directory default-directory) | 651 | (file-name-as-directory default-directory))))) |
| 654 | "."))))) | ||
| 655 | (setq process-environment | 652 | (setq process-environment |
| 656 | (delete (concat "PWD=" pwd) | 653 | (delete (concat "PWD=" pwd) |
| 657 | process-environment))))) | 654 | process-environment))))) |