emacs-devel
[Top][All Lists]
Advanced

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

TAB in find-file with PARTIAL-COMPLETION-MODE on


From: A Soare
Subject: TAB in find-file with PARTIAL-COMPLETION-MODE on
Date: Sun, 18 Feb 2007 01:00:00 +0100 (CET)

TAB does not complete in in find-file when PARTIAL-COMPLETION-MODE is active.

I do not write another description of this bug.

Just I describe the solution from this patch: the output from

 cvs -d:pserver:address@hidden:/sources/emacs diff -c emacs/lisp/files.el

---------------------------------------------------------------------------------------
Index: emacs/lisp/files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.884
diff -c -r1.884 files.el
*** emacs/lisp/files.el 11 Feb 2007 02:28:57 -0000      1.884
--- emacs/lisp/files.el 17 Feb 2007 23:46:19 -0000
***************
*** 1056,1062 ****
               (and buffer-file-name
                    (abbreviate-file-name buffer-file-name))))
          (minibuffer-with-setup-hook
!             (lambda () (setq minibuffer-default find-file-default))
            (read-file-name prompt nil default-directory mustmatch)))
        t))

--- 1056,1063 ----
               (and buffer-file-name
                    (abbreviate-file-name buffer-file-name))))
          (minibuffer-with-setup-hook
!             (lambda () (setq minibuffer-default find-file-default
!                                minibuffer-completing-file-name 
partial-completion-mode))
            (read-file-name prompt nil default-directory mustmatch)))
        t))
----------------------------------------------------------------------------------

When partial-completion is active, the completion is made by the function

(defun PC-do-completion (&optional mode beg end)

from complete.el.

Here is the backtrace when I press TAB in execute-extended-command (M-x) and 
find-file (C-x C-f):


(edebug-backtrace)

-------------------------------------------------
PC-do-completion(nil)
PC-complete()
call-interactively(PC-complete)

execute-extended-command(nil)
call-interactively(execute-extended-command)

-------------------------------------------------

PC-do-completion(nil)
PC-complete()
call-interactively(PC-complete)

read-file-name("Find file: " nil "/mnt/doc/emacs/lisp/" nil)
find-file-read-args("Find file: " nil)
call-interactively(find-file)

-------------------------------------------------

PC-do-completion check that is called from find-file (so in this case it deals 
with a file) by the line:

(filename (funcall PC-completion-as-file-name-predicate))

The definition of PC-completion-as-file-name-predicate is:


(defvar PC-completion-as-file-name-predicate
  (lambda () minibuffer-completing-file-name)
  "A function testing whether a minibuffer completion now will work 
filename-style.
The function takes no arguments, and typically looks at the value
of `minibuffer-completion-table' and the minibuffer contents.")


So PC-completion-as-file-name-predicate = minibuffer-completing-file-name;


Here is the bug.

Find-file should set this var to t (i.e. TRUE) when called by find-file. But it 
does not.

So in my patch I set in the hook minibuffer-with-setup-hook this variable to 
true if partial-completion is enabled, and to false otherwise, i.e.

minibuffer-completing-file-name = (eval partial-completion-mode)



That is all.


Alin Soare









reply via email to

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