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

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

Re: completing include files with complete.el not working (and also a re


From: Stefan Monnier
Subject: Re: completing include files with complete.el not working (and also a read-file-name-function issue)
Date: Mon, 22 May 2006 14:08:41 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Do emacs -q
> M-x partial-completion-mode RET
> C-x C-f <sys/ TAB

> this will print "No Match"

> in emacs-21.4 it used to give as completions the files in /usr/include/sys/

Thanks.  It seems the patch below fixes it,


        Stefan


--- complete.el 24 Apr 2006 09:04:07 -0400      1.52
+++ complete.el 22 May 2006 14:06:49 -0400      
@@ -369,7 +369,7 @@
         (str (buffer-substring beg end))
         (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
         (ambig nil)
-        basestr
+        basestr origstr
         env-on
         regex
         p offset
@@ -415,7 +415,7 @@
                                    (file-name-nondirectory dir))
                                   "*/" file))
                (setq dir (file-name-directory dir)))
-             (setq str (concat dir file))))
+             (setq origstr str str (concat dir file))))
 
       ;; Look for wildcard expansions in directory name
       (and filename
@@ -443,7 +443,14 @@
                     (setq str (concat dir (file-name-nondirectory str)))
                     (insert str)
                     (setq end (+ beg (length str)))))
-              (setq filename nil table nil pred nil))))
+              (if origstr
+                   ;; If the wildcards were introduced by us, it's possible
+                   ;; that read-file-name-internal (especially our
+                   ;; PC-include-file advice) can still find matches for the
+                   ;; original string even if we couldn't, so remove the
+                   ;; added wildcards.
+                   (setq str origstr)
+                (setq filename nil table nil pred nil)))))
 
       ;; Strip directory name if appropriate
       (if filename




reply via email to

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