]> git.eshelyaron.com Git - emacs.git/commitdiff
Give better error messages when trying to load non-existent symlinks
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 12 Jul 2011 23:25:50 +0000 (01:25 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 12 Jul 2011 23:25:50 +0000 (01:25 +0200)
* files.el (after-find-file): Give a better error message when
trying to find a symlink that points to a file that doesn't exist
(bug#4398).

lisp/ChangeLog
lisp/files.el

index 4d75309e9058bfbec93cf5623d13f6e49b8fcfae..19c80a6588855a957e4b06c9daeae36c43df7c8f 100644 (file)
@@ -1,5 +1,9 @@
 2011-07-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * files.el (after-find-file): Give a better error message when
+       trying to find a symlink that points to a file that doesn't exist
+       (bug#4398).
+
        * progmodes/cc-vars.el: Remove (probably) misleading comment
        (bug#4396).
 
index 1071adb6967310bf3f9ed81dbcd124579a69cfe1..bf38ce39a074d19470fed4b443c27ac3b05c01cc 100644 (file)
@@ -2060,7 +2060,11 @@ unless NOMODES is non-nil."
             ((not warn) nil)
             ((and error (file-attributes buffer-file-name))
              (setq buffer-read-only t)
-             "File exists, but cannot be read")
+             (if (and (file-symlink-p buffer-file-name)
+                      (not (file-exists-p
+                            (file-chase-links buffer-file-name))))
+                 "Symbolic link that points to nonexistent file"
+               "File exists, but cannot be read"))
             ((not buffer-read-only)
              (if (and warn
                       ;; No need to warn if buffer is auto-saved