all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* compilation-find-file does not allow completing two levels of directory
@ 2007-01-15 19:33 Stephen Leake
  2007-01-15 21:47 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Leake @ 2007-01-15 19:33 UTC (permalink / raw)


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  <monnier@iro.umontreal.ca>

	* 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-15 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-15 19:33 compilation-find-file does not allow completing two levels of directory Stephen Leake
2007-01-15 21:47 ` Stefan Monnier
2007-01-15 23:34   ` Stephen Leake

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.