emacs-devel
[Top][All Lists]
Advanced

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

compilation-find-file does not allow completing two levels of directory


From: Stephen Leake
Subject: compilation-find-file does not allow completing two levels of directory
Date: Mon, 15 Jan 2007 14:33:18 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt)

When compilation-search-path is not fully set up, and
compilation-find-file prompts for the file, it does not allow
completion when the file is actually two or more directory levels
down.

This is due to this change:

2006-07-18  Stefan Monnier  <address@hidden>

        * progmodes/compile.el (compilation-find-file): Handle the
        cases where the user selects a non-existent file.

This change was made in compile.el CVS revision 1.403.

The issue is the predicate passed to 'read-file-name'.

Example: find "emacs/progmodes/ada-mode.el" when the prompt starts in
  "emacs/admin"

Change the paths to where your emacs source exists, then eval:

(read-file-name "file: " "/Gnu/Emacs/emacs/admin" "ada-mode.el" t nil
nil)

Type "<DEL> <DEL> <DEL> <DEL> <DEL> l i <tab> pr <tab> <ret"; the file is found.

Now eval this (the predicate is the same as used by
compilation-find-file):

(read-file-name "file: " "/Gnu/Emacs/emacs/admin" "ada-mode.el" t nil 
                        (lambda (name)
                          (if (file-directory-p name)
                              (setq name (expand-file-name "ada-mode.el" name)))
                          (file-exists-p name)))

Type "<DEL> <DEL> <DEL> <DEL> <DEL> l i <tab>"; you get "[no match]".

As the comment in 'compliation-find-file' says, this predicate is
ignored when a file dialog is used. I suggest we just delete the
predicate, and keep the 'file-exists-p' check after the call to
'read-file-name'. 

propsed patch:

RCS file: /sources/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.413
diff -u -r1.413 compile.el
--- compile.el  24 Nov 2006 10:29:44 -0000      1.413
+++ compile.el  15 Jan 2007 19:32:56 -0000
@@ -1852,17 +1852,7 @@
           (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))))
+                        spec-dir filename t nil nil))
                  (origname name))
             (cond
              ((not (file-exists-p name))

-- 
-- Stephe




reply via email to

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