emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile-goto-error can signal wrong-type-argument


From: Stefan Monnier
Subject: Re: Compile-goto-error can signal wrong-type-argument
Date: Tue, 11 Jul 2006 10:21:20 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>>>> "Marshall," == Marshall, Simon <address@hidden> writes:

> This is a buggette in CVS head as of 2006-06-19.
> src/emacs -Q
> Start a compilation which is going to raise some errors.  Then mouse-1 on an
> error to get the popup window "Find this error in (default ...)" for you to
> navigate to the file.  (The error message doesn't contain enough info for
> Emacs to be able to work it out itself.)  So far, so good.

> In the popup, navigate to the wrong directory and click on OK without going
> through the process of finding the file entry and selecting it first.  (You
> can't - you're in the wrong directory!)

Does the patch below give a cleaner behavior (it should prevent you from
selecting a directory in which the file doesn't exist).


        Stefan


Index: compile.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.400
diff -u -b -r1.400 compile.el
--- compile.el  9 Jul 2006 15:17:04 -0000       1.400
+++ compile.el  11 Jul 2006 14:17:52 -0000
@@ -1796,7 +1796,6 @@
 If FILENAME is not found at all, ask the user where to find it.
 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
   (or formats (setq formats '("%s")))
-  (save-excursion
     (let ((dirs compilation-search-path)
          (spec-dir (if directory
                        (expand-file-name directory)
@@ -1821,6 +1820,7 @@
        (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)
@@ -1828,16 +1828,22 @@
                         (read-file-name
                          (format "Find this %s in (default %s): "
                                  compilation-error filename)
-                         spec-dir filename t))))
+                          spec-dir filename t nil
+                          (lambda (name)
+                            (if (file-directory-p name)
+                                (setq name (expand-file-name filename name)))
+                            (file-exists-p name))))))
              (if (file-directory-p name)
                  (setq name (expand-file-name filename name)))
              (setq buffer (and (file-exists-p name)
-                               (find-file name))))))
+                                (find-file-noselect name)))))))
       ;; Make intangible overlays tangible.
-      (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.
+    ;; (mapcar (function (lambda (ov)
+    ;;                   (when (overlay-get ov 'intangible)
+    ;;                     (overlay-put ov 'intangible nil))))
+    ;;         (overlays-in (point-min) (point-max)))
       buffer)))
 
 (defun compilation-get-file-structure (file &optional fmt)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]