]> git.eshelyaron.com Git - emacs.git/commitdiff
(compilation-find-file): Handle the
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 Jul 2006 14:40:29 +0000 (14:40 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 Jul 2006 14:40:29 +0000 (14:40 +0000)
cases where the user selects a non-existent file.

lisp/ChangeLog
lisp/progmodes/compile.el

index ffeac9d760ac944765f31d2380abdd8cd30a10c8..885ffca4f24b5bef6edc8d5bb0638a9f9401bc2a 100644 (file)
@@ -1,3 +1,12 @@
+2006-07-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/compile.el (compilation-find-file): Handle the
+       cases where the user selects a non-existent file.
+
+2006-07-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * bindings.el (minibuffer-local-map): Rebind TAB so it inserts a \t.
+
 2006-07-17  Chong Yidong  <cyd@stupidchicken.com>
 
        * subr.el (sit-for): Just sleep-for if noninteractive.
index 2e60594168a028414af3e2f6c4e8339528c35c77..525c462d4ebeba3c46c1d44732a42a0fd33b0e57 100644 (file)
@@ -1825,28 +1825,44 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
                           (find-file-noselect name))
               fmts (cdr fmts)))
       (setq dirs (cdr dirs)))
-    (or buffer
-        ;; The file doesn't exist.  Ask the user where to find it.
-        (save-excursion          ;This save-excursion is probably not right.
-          (let ((pop-up-windows t))
-            (compilation-set-window (display-buffer (marker-buffer marker))
-                                    marker)
-            (let ((name (expand-file-name
-                         (read-file-name
-                          (format "Find this %s in (default %s): "
-                                  compilation-error filename)
-                          spec-dir filename t))))
-              (if (file-directory-p name)
-                  (setq name (expand-file-name filename name)))
-              (setq buffer (and (file-exists-p name)
-                                (find-file-noselect name)))))))
+    (while (null buffer)    ;Repeat until the user selects an existing file.
+      ;; The file doesn't exist.  Ask the user where to find it.
+      (save-excursion            ;This save-excursion is probably not right.
+        (let ((pop-up-windows t))
+          (compilation-set-window (display-buffer (marker-buffer marker))
+                                  marker)
+          (let* ((name (read-file-name
+                        (format "Find this %s in (default %s): "
+                                compilation-error filename)
+                        spec-dir filename t nil
+                        ;; Try to make sure the user can only select
+                        ;; a valid answer.  This predicate may be ignored,
+                        ;; tho, so we still have to double-check afterwards.
+                        ;; TODO: We should probably fix read-file-name so
+                        ;; that it never ignores this predicate, even when
+                        ;; using popup dialog boxes.
+                        (lambda (name)
+                          (if (file-directory-p name)
+                              (setq name (expand-file-name filename name)))
+                          (file-exists-p name))))
+                 (origname name))
+            (cond
+             ((not (file-exists-p name))
+              (message "Cannot find file `%s'" name)
+              (ding) (sit-for 2))
+             ((and (file-directory-p name)
+                   (not (file-exists-p
+                         (setq name (expand-file-name filename name)))))
+              (message "No `%s' in directory %s" filename origname)
+              (ding) (sit-for 2))
+             (t
+              (setq buffer (find-file-noselect name))))))))
     ;; Make intangible overlays tangible.
-    ;; This is very weird: it's not even clear which is the current buffer,
-    ;; so the code below can't be expected to DTRT here.  --Stef
-    (mapcar (function (lambda (ov)
-                        (when (overlay-get ov 'intangible)
-                          (overlay-put ov 'intangible nil))))
-            (overlays-in (point-min) (point-max)))
+    ;; This is weird: it's not even clear which is the current buffer,
+    ;; so the code below can't be expected to DTRT here.  -- Stef
+    (dolist (ov (overlays-in (point-min) (point-max)))
+      (when (overlay-get ov 'intangible)
+        (overlay-put ov 'intangible nil)))
     buffer))
 
 (defun compilation-get-file-structure (file &optional fmt)