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

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

Re: PC-do-completion unconditionally adds wildcards to directory


From: Klaus Zeitler
Subject: Re: PC-do-completion unconditionally adds wildcards to directory
Date: 16 Oct 2003 12:26:34 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:
    Stefan> 
    Stefan> So if I understand correctly, you are in directory
    Stefan> "/vobs/ubtssw_onecell_images/sunos/sunboard/src/misc.cc@@/" and
    Stefan> the prompt says "main/58" and you hit RET.  Two things I do not
    Stefan> understand:
    Stefan> 
    Stefan> 1 - why was the * added ?

that's done by that section in PC-do-completion that I mentioned in my
original error report (starting with ";; Add wildcards if necessary")

    Stefan> Is `main' not a directory ?

yes it's a directory

    Stefan>     What does (file-directory-p "main/") return when run from the
    Stefan>     misc.cc@@ directory ?

t

    Stefan> 2 - why wasn't the * removed in the part that says
    Stefan> 
    Stefan>       ;; Look for wildcard expansions in directory name

that could be the problem.
I quick glance at this section that is supposed to remove the wildcards
didn't tell me much. I'll see if I can find time to debug it.

    Stefan> The first part is the more troubling (the second probably derives
    Stefan> from the same problem as the first).
    Stefan> 
    Stefan> Could you try and step through PC-do-completion to see what
    Stefan> happens in the two respective sections (the part that adds the *
    Stefan> and the part that fails to remove it) ?

the part where the * is added is simple and easy to understand and this code
wasn't there in 21.3. I don't know why it was added.
But I wonder why one would add the wildcard, if the next section is supposed
to remove it.

    Stefan> The backtrace shows you're using some kind of clearcase.el
    Stefan> package.  I doubt this has any influence, but it would be good to
    Stefan> reproduce the problem without loading this package, just to be
    Stefan> sure.

it took me a while to figure out why I couldn't get the same error without
the clearcase package. 2 conditions must be met:
1. insert-default-directory must be set to nil 
2. If I'm in the correct default directory it works, cause
PC-do-completion will immediately return 'complete right at the start, due to
the following code:

    ;; Check if buffer contents can already be considered complete
    (if (and (eq mode 'exit)
             (PC-is-complete-p str table pred))
        'complete

only if I'm in another directory PC-do-completion will do all its mumbo-jumbo

Thus if I execute
"cd /vobs/ubtssw_onecell_images/sunos/sunboard/src/misc.cc@@/"
and then call read-file-name it works, but obviously the default directory
for the buffer /vobs/ubtssw_onecell_images/sunos/sunboard/src/misc.cc is
/vobs/ubtssw_onecell_images/sunos/sunboard/src and not 
/vobs/ubtssw_onecell_images/sunos/sunboard/src/misc.cc@@/


I think I can now give you a simple example that make it possible to
reproduce the problem:
1. Create ~/subdir
2. touch ~/subdir/file
3. In scratch buffer make sure the pwd is not ~
4. turn on partial-completion-mode
5. define and execute
(defun get-name ()
  (interactive)
  (let ((insert-default-directory nil))
    (read-file-name "read: " "~" "subdir/file" t "subdir/file")))
(get-name)


Klaus


-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             address@hidden  |
 ------------------------------------------
---
Napoleon: What shall we do with this soldier, Guiseppe?
          Everything he says is wrong.
Guiseppe: Make him a general, Excellency, and then everything he says
          will be right.          -- G. B. Shaw, "The Man of Destiny"




reply via email to

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