From fed000725c6fc60e3919209779d60ec3adf5cb10 Mon Sep 17 00:00:00 2001
From: Michael Albinus <michael.albinus@gmx.de>
Date: Thu, 7 Feb 2013 09:50:04 +0100
Subject: [PATCH] * vc/vc-hooks.el (vc-find-file-hook): `buffer-file-truename'
 can be nil.  Handle this.  (Bug#13636)

---
 lisp/ChangeLog      | 5 +++++
 lisp/vc/vc-hooks.el | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a0e88362c4b..4211901d64f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-07  Michael Albinus  <michael.albinus@gmx.de>
+
+	* vc/vc-hooks.el (vc-find-file-hook): `buffer-file-truename' can
+	be nil.  Handle this.  (Bug#13636)
+
 2013-02-07  Richard Stallman  <rms@gnu.org>
 
 	* mail/rmail.el (rmail-variables): Specify `no-conversion' for
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 818b37b3c34..5c8a4515b7e 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -858,8 +858,10 @@ current, and kill the buffer that visits the link."
 	  (set (make-local-variable 'backup-inhibited) t))
 	;; Let the backend setup any buffer-local things he needs.
 	(vc-call-backend backend 'find-file-hook))
-       ((let* ((truename (expand-file-name buffer-file-truename))
-	       (link-type (and (not (equal buffer-file-name truename))
+       ((let* ((truename (and buffer-file-truename
+			      (expand-file-name buffer-file-truename)))
+	       (link-type (and truename
+			       (not (equal buffer-file-name truename))
 			       (vc-backend truename))))
 	  (cond ((not link-type) nil)	;Nothing to do.
 		((eq vc-follow-symlinks nil)
-- 
2.39.5