]> code.delx.au - gnu-emacs/blobdiff - lisp/minibuffer.el
Move comment for last change to right place.
[gnu-emacs] / lisp / minibuffer.el
index 4b2b99de5e551493bf9efe0dd782584f58a97d50..b64a8d08ae5bc7a490608dc50933c63ce1f31e0f 100644 (file)
@@ -130,7 +130,7 @@ This alist may be a full list of possible completions so that FUN can ignore
 the value of its argument.  If completion is performed in the minibuffer,
 FUN will be called in the buffer from which the minibuffer was entered.
 
-The result of the `dynamic-completion-table' form is a function
+The result of the `completion-table-dynamic' form is a function
 that can be used as the COLLECTION argument to `try-completion' and
 `all-completions'.  See Info node `(elisp)Programmed Completion'."
   (lexical-let ((fun fun))
@@ -615,14 +615,9 @@ input if confirmed."
         (let ((exts '(" " "-"))
               (before (substring string 0 point))
               (after (substring string point))
-              ;; If the user hasn't entered any text yet, then she
-              ;; presumably hits SPC to see the *completions*, but
-              ;; partial-completion will often find a " " or a "-" to match.
-              ;; So disable partial-completion in that situation.
-              (completion-styles
-               (or (and (equal string "")
-                        (remove 'partial-completion completion-styles))
-                   completion-styles))
+             ;; Disable partial-completion for this.
+             (completion-styles
+              (remove 'partial-completion completion-styles))
              tem)
          (while (and exts (not (consp tem)))
             (setq tem (completion-try-completion
@@ -814,7 +809,7 @@ of the differing parts is, by contrast, slightly highlighted."
         completions)
        base-size))))
 
-(defun display-completion-list (completions &optional common-substring base-size)
+(defun display-completion-list (completions &optional common-substring)
   "Display the list of completions, COMPLETIONS, using `standard-output'.
 Each element may be just a symbol or string
 or may be a list of two strings to be printed as if concatenated.
@@ -826,14 +821,10 @@ properties of `highlight'.
 At the end, this runs the normal hook `completion-setup-hook'.
 It can find the completion buffer in `standard-output'.
 
-The optional arg COMMON-SUBSTRING, if non-nil, should be a string
+The obsolete optional arg COMMON-SUBSTRING, if non-nil, should be a string
 specifying a common substring for adding the faces
 `completions-first-difference' and `completions-common-part' to
-the completions buffer.
-
-The optional arg BASE-SIZE, if non-nil, which should be an
-integer that specifies the value of `completion-base-size' for
-the completion buffer."
+the completions buffer."
   (if common-substring
       (setq completions (completion-hilit-commonality
                          completions (length common-substring))))
@@ -842,21 +833,22 @@ the completion buffer."
       (with-temp-buffer
        (let ((standard-output (current-buffer))
              (completion-setup-hook nil))
-         (display-completion-list completions common-substring base-size))
+         (display-completion-list completions common-substring))
        (princ (buffer-string)))
 
-    (with-current-buffer standard-output
-      (goto-char (point-max))
-      (if (null completions)
-         (insert "There are no possible completions of what you have typed.")
-
-       (insert "Possible completions are:\n")
-        (let ((last (last completions)))
-          ;; If BASE-SIZE is unspecified, set it from the tail of the list.
-         (set (make-local-variable 'completion-base-size)
-              (or base-size (cdr last) 0))
-          (setcdr last nil)) ;Make completions a properly nil-terminated list.
-       (completion--insert-strings completions))))
+    (let ((mainbuf (current-buffer)))
+      (with-current-buffer standard-output
+       (goto-char (point-max))
+       (if (null completions)
+           (insert "There are no possible completions of what you have typed.")
+         (insert "Possible completions are:\n")
+         (let ((last (last completions)))
+           ;; Set base-size from the tail of the list.
+           (set (make-local-variable 'completion-base-size)
+                (or (cdr last)
+                    (and (minibufferp mainbuf) 0)))
+           (setcdr last nil)) ; Make completions a properly nil-terminated list.
+         (completion--insert-strings completions)))))
 
   ;; The hilit used to be applied via completion-setup-hook, so there
   ;; may still be some code that uses completion-common-substring.
@@ -1416,7 +1408,8 @@ PATTERN is as returned by `completion-pcm--string->pattern'."
     ;; since all-completions is written in C!
     (let* (;; Convert search pattern to a standard regular expression.
           (regex (completion-pcm--pattern->regex pattern))
-          (completion-regexp-list (cons regex completion-regexp-list))
+           (case-fold-search completion-ignore-case)
+           (completion-regexp-list (cons regex completion-regexp-list))
           (compl (all-completions
                    (concat prefix (if (stringp (car pattern)) (car pattern) ""))
                   table pred))
@@ -1429,8 +1422,7 @@ PATTERN is as returned by `completion-pcm--string->pattern'."
       (if (not (functionp table))
          ;; The internal functions already obeyed completion-regexp-list.
          compl
-       (let ((case-fold-search completion-ignore-case)
-              (poss ()))
+       (let ((poss ()))
          (dolist (c compl)
            (when (string-match regex c) (push c poss)))
          poss)))))
@@ -1438,6 +1430,7 @@ PATTERN is as returned by `completion-pcm--string->pattern'."
 (defun completion-pcm--hilit-commonality (pattern completions)
   (when completions
     (let* ((re (completion-pcm--pattern->regex pattern '(point)))
+           (case-fold-search completion-ignore-case)
            (last (last completions))
            (base-size (cdr last)))
       ;; Remove base-size during mapcar, and add it back later.