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: 17 Oct 2003 09:25:43 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:
    Stefan> 
    Stefan> Hmm... that's odd.  In the code:
    Stefan> 
    Stefan>       ;; Add wildcards if necessary
    Stefan>       (and filename
    Stefan>            (let ((dir (file-name-directory str))
    Stefan>                  (file (file-name-nondirectory str)))
    Stefan>              (while (and (stringp dir) (not (file-directory-p dir)))
    Stefan>                (setq dir (directory-file-name dir))
    Stefan>                (setq file (concat (replace-regexp-in-string
    Stefan>                                    PC-delim-regex "*\\&"
    Stefan>                                    (file-name-nondirectory dir))
    Stefan>                                   "*/" file))
    Stefan>                (setq dir (file-name-directory dir)))
    Stefan>              (setq str (concat dir file))))
    Stefan> 
    Stefan> based on what you tell me I expect that when we reach the `while',
    Stefan> `dir' is set to "main/" and `file' to "58" and (stringp dir)
    Stefan> should return t and (file-directory-p dir) should also return t so
    Stefan> the `and' expression should return nil and the body of the loop
    Stefan> should never be executed.
    Stefan> 
    Stefan> Maybe the problem is as you say: the default-directory is not set
    Stefan> to what I expect.

yes, I'm sure now that this is the problem

    >> 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.
    Stefan> 
    Stefan> It was added so you can do C-x C-f ~/e/e/e TAB RET to open up your
    Stefan> ~/etc/emacs/emacs.el file.  Previously you had to do ~/e*/e*/e TAB
    Stefan> RET.

ah I see now (good idea :-)

    Stefan> Oh....right...now I remember: the default directory to be used for
    Stefan> completion is passed as the `predicate' rather than being passed in
    Stefan> `default-directory'.
    Stefan> Obviously, the original author of p-c-c didn't take it into
    Stefan> account either and I didn't notice the problem.
    Stefan> 
    Stefan> Can you try the patch below and tell us if it helps without
    Stefan> breaking something else ?

tried it and it works fine. Thanks for your quick support.

Klaus


-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             address@hidden  |
 ------------------------------------------
---
Talk sense to a fool and he calls you foolish.  -- Euripides




reply via email to

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