]> code.delx.au - gnu-emacs/blobdiff - lisp/complete.el
Fixes: debbugs:6594
[gnu-emacs] / lisp / complete.el
index ecffb660a26ba0a8c948aae651a8e1b2fea6ba75..0f8e52630f6324d20b5d9a2a267d81d00b2d59e8 100644 (file)
@@ -1,7 +1,7 @@
 ;;; complete.el --- partial completion mechanism plus other goodies
 
 ;; Copyright (C) 1990, 1991, 1992, 1993, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: abbrev convenience
@@ -231,11 +231,11 @@ second TAB brings up the `*Completions*' buffer."
   (funcall
    (if partial-completion-mode 'add-hook 'remove-hook)
    'choose-completion-string-functions
-   (lambda (choice buffer mini-p base-size)
+   (lambda (choice buffer &rest ignored)
      ;; When completing M-: (lisp- ) with point before the ), it is
      ;; not appropriate to go to point-max (unlike the filename case).
      (if (and (not PC-goto-end)
-              mini-p)
+              (minibufferp buffer))
          (goto-char (point-max))
        ;; Need a similar hack for the non-minibuffer-case -- gm.
        (when PC-do-completion-end
@@ -290,7 +290,7 @@ See `PC-complete' for details.
 This can be bound to other keys, like `-' and `.', if you wish."
   (interactive)
   (if (eq (PC-was-meta-key) PC-meta-flag)
-      (if (eq last-command-char ? )
+      (if (eq last-command-event ? )
          (minibuffer-complete-word)
        (self-insert-command 1))
     (self-insert-command 1)
@@ -737,8 +737,6 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                     (setq prefix (PC-try-completion
                                   (PC-chunk-after basestr skip) poss)))
                (let ((first t) i)
-                 ;; Retain capitalization of user input even if
-                 ;; completion-ignore-case is set.
                  (if (eq mode 'word)
                      (setq prefix (PC-chop-word prefix basestr)))
                  (goto-char (+ beg (length dirname)))
@@ -746,27 +744,25 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                                (setq i 0) ; index into prefix string
                                (while (< i (length prefix))
                                  (if (and (< (point) end)
-                                          (eq (downcase (aref prefix i))
-                                              (downcase (following-char))))
-                                     ;; same char (modulo case); no action
-                                     (forward-char 1)
-                                   (if (and (< (point) end)
-                                            (and (looking-at " ")
-                                                  (memq (aref prefix i)
-                                                       PC-delims-list)))
-                                       ;; replace " " by the actual delimiter
-                                       (progn
-                                         (delete-char 1)
-                                         (insert (substring prefix i (1+ i))))
-                                     ;; insert a new character
+                                           (or (eq (downcase (aref prefix i))
+                                                  (downcase (following-char)))
+                                              (and (looking-at " ")
+                                                   (memq (aref prefix i)
+                                                         PC-delims-list))))
+                                     ;; replace " " by the actual delimiter
+                                      ;; or input char by prefix char
                                      (progn
-                                        (and filename (looking-at "\\*")
-                                             (progn
-                                               (delete-char 1)
-                                               (setq end (1- end))))
-                                       (setq improved t)
-                                        (insert (substring prefix i (1+ i)))
-                                       (setq end (1+ end)))))
+                                       (delete-char 1)
+                                       (insert (substring prefix i (1+ i))))
+                                   ;; insert a new character
+                                   (progn
+                                     (and filename (looking-at "\\*")
+                                          (progn
+                                            (delete-char 1)
+                                            (setq end (1- end))))
+                                     (setq improved t)
+                                     (insert (substring prefix i (1+ i)))
+                                     (setq end (1+ end))))
                                  (setq i (1+ i)))
                                (or pt (setq pt (point)))
                                (looking-at PC-delim-regex))