(font_check_object): Delete it.
[bpt/emacs.git] / lisp / complete.el
index cbc678d..058bcd7 100644 (file)
@@ -9,10 +9,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -491,8 +489,9 @@ GOTO-END is non-nil, however, it instead replaces up to END."
       (and filename
            (let ((dir (file-name-directory str))
                  (file (file-name-nondirectory str))
-                ;; The base dir for file-completion is passed in `predicate'.
-                (default-directory (expand-file-name pred)))
+                ;; The base dir for file-completion was passed in `predicate'.
+                (default-directory (if (stringp pred) (expand-file-name pred)
+                                      default-directory)))
              (while (and (stringp dir) (not (file-directory-p dir)))
                (setq dir (directory-file-name dir))
                (setq file (concat (replace-regexp-in-string
@@ -506,8 +505,9 @@ GOTO-END is non-nil, however, it instead replaces up to END."
       (and filename
           (string-match "\\*.*/" str)
           (let ((pat str)
-                ;; The base dir for file-completion is passed in `predicate'.
-                (default-directory (expand-file-name pred))
+                ;; The base dir for file-completion was passed in `predicate'.
+                (default-directory (if (stringp pred) (expand-file-name pred)
+                                      default-directory))
                 files)
             (setq p (1+ (string-match "/[^/]*\\'" pat)))
             (while (setq p (string-match PC-delim-regex pat p))
@@ -522,7 +522,8 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                   (while (and (setq p (cdr p))
                               (equal dir (file-name-directory (car p)))))
                   (if p
-                      (setq filename nil table nil pred nil
+                      (setq filename nil table nil
+                             pred (if (stringp pred) nil pred)
                             ambig t)
                     (delete-region beg end)
                     (setq str (concat dir (file-name-nondirectory str)))
@@ -535,7 +536,8 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                        ;; even if we couldn't, so remove the added
                        ;; wildcards.
                    (setq str origstr)
-                (setq filename nil table nil pred nil)))))
+                (setq filename nil table nil
+                       pred (if (stringp pred) nil pred))))))
 
       ;; Strip directory name if appropriate
       (if filename
@@ -621,8 +623,10 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                                                    (match-string 2 str)
                                                    "[A-Za-z0-9]*[^A-Za-z0-9]"))
                           p (1+ (length (match-string 1 str))))))
-                (setq regex (concat "\\`" (mapconcat #'list str "[^-]*-"))
-                      p 1))))
+             (setq regex (concat "\\`" (mapconcat (lambda (c)
+                                                    (regexp-quote (string c)))
+                                                  str "[^-]*-"))
+                   p 1))))
         (when p
        ;; Use all-completions to do an initial cull.  This is a big win,
        ;; since all-completions is written in C!
@@ -964,7 +968,7 @@ or properties are considered."
                    (+ (point) 2)
                    (point-min)))
           (minibuffer-completion-table 'PC-read-file-name-internal)
-          (minibuffer-completion-predicate "")
+          (minibuffer-completion-predicate nil)
           (PC-not-minibuffer t))
      (goto-char end)
      (PC-do-completion nil beg end)))
@@ -1094,7 +1098,7 @@ absolute rather than relative to some directory on the SEARCH-PATH."
          (setq sorted (cdr sorted)))
        compressed))))
 
-(defun PC-read-file-name-internal (string dir action)
+(defun PC-read-file-name-internal (string pred action)
   "Extend `read-file-name-internal' to handle include files.
 This is only used by "
   (if (string-match "<\\([^\"<>]*\\)>?\\'" string)
@@ -1105,12 +1109,12 @@ This is only used by "
                         (format (if (string-match "/\\'" x) "<%s" "<%s>") x))
                      (PC-include-file-all-completions
                       name (PC-include-file-path)))))
-              (cond
-               ((not completion-table) nil)
-               ((eq action 'lambda) (test-completion str2 completion-table nil))
-               ((eq action nil) (PC-try-completion str2 completion-table nil))
-          ((eq action t) (all-completions str2 completion-table nil))))
-    (read-file-name-internal string dir action)))
+        (cond
+         ((not completion-table) nil)
+         ((eq action 'lambda) (test-completion str2 completion-table nil))
+         ((eq action nil) (PC-try-completion str2 completion-table nil))
+         ((eq action t) (all-completions str2 completion-table nil))))
+    (read-file-name-internal string pred action)))
 \f
 
 (provide 'complete)