Subject: bug#11127: 24.0.94; [PATCH] Tutorial breaks with modified key bindings

From: "Aaron S. Hawley" <[email-masked]>
Date: Fri, 30 Mar 2012 14:12:54 -0400

> I'm not sure that will help with the specified example, where dir-locals
> are applied by a class setting, not an actual file.

My understanding is that all dir-locals classes need to apply to some
directory path.

> Also, the tutorial explains the use of C-x C-s, which implicitly relies
> on the directory being writable (maybe it should actually set d-d to ~).

Stefan's last comment made me wonder whether we could let-bind
`default-directory' to a bogus value that will never be a dir-locals
path.  How about the empty string?  This patch seems to work.  I
tested it with the same scenario before.

emacs -Q
(progn
  (dir-locals-set-class-variables
   'unwritable-directory
   '((nil . ((buffer-read-only . t)))))
  (dir-locals-set-directory-class default-directory 'unwritable-directory))
C-h t

--- tutorial.el	2012-02-13 11:13:25.000000000 -0500
+++ tutorial.el	2012-03-30 13:57:49.942206100 -0400
@@ -830,7 +830,8 @@
         (if old-tut-file
             (progn
               (insert-file-contents (tutorial--saved-file))
-	      (let ((enable-local-variables :safe))
+	      (let ((default-directory "")
+		    (enable-local-variables :safe))
 		(hack-local-variables))
               (goto-char (point-min))
               (setq old-tut-point
@@ -847,7 +848,8 @@
               (goto-char tutorial--point-before-chkeys)
               (setq tutorial--point-before-chkeys (point-marker)))
           (insert-file-contents (expand-file-name filename tutorial-directory))
-	  (let ((enable-local-variables :safe))
+	  (let ((default-directory "")
+		(enable-local-variables :safe))
 	    (hack-local-variables))
           (forward-line)
           (setq tutorial--point-before-chkeys (point-marker)))