[Top][All Lists]

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

Re: partial-completion-mode and deleting symlink problem

From: Dan Nicolaescu
Subject: Re: partial-completion-mode and deleting symlink problem
Date: Sat, 21 May 2005 11:03:37 -0700

Stefan Monnier <address@hidden> writes:

  > RMS wrote:
  > >
  > > This code needs to specify some other predicate, instead of file-exists-p.
  > > Perhaps
  > >   (lambda (filename) (or (file-exists-p filename) (file-symlink-p 

Where exactly would you want the predicate to be specified? 
In the partial-completion-mode code? (Like in the attached patch?)
Or in read-file-name? 

  > The normal completion simply has no predicate at all.  I think
  > partial-completion-mode should do likewise.

The predicate is _not_ specified by the partial-completion-mode code!
It is set by this code in read-file-name:

            specbind (intern ("read-file-name-predicate"),
                  (NILP (predicate) ? Qfile_exists_p : predicate));

If you look in one of my messages in this thread: 
PC-do-completion calls  test-completions that calls
read-file-name-internal which  returns Qnil because of this code:

                     if (!NILP (Vread_file_name_predicate))
                         return call1 (Vread_file_name_predicate, string);
                      read-file-name-predicate was bound to
                      file-exists-p in read-file-name, 
                      and (file-exists-p "/tmp/DELETEME") return nil.

This patch fixes the original problem. Is this the correct fix? (I am
not sure it is)

*** complete.el 30 Mar 2005 07:48:38 -0800      1.43
--- complete.el 20 May 2005 16:11:47 -0700      
*** 364,369 ****
--- 364,372 ----
         p offset
         (poss nil)
+        (read-file-name-predicate (lambda (arg) 
+                                    (or (file-exists-p arg)
+                                        (file-symlink-p arg))))
         (case-fold-search completion-ignore-case))
      ;; Check if buffer contents can already be considered complete

reply via email to

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