# HG changeset patch # User Chong Yidong # Date 1233156872 0 # Node ID 9b2f88075647319d23636acc555d1cac0dd6778a # Parent 04760bc22f9404d9cc534eca1373dbbe07d31c08 (PC-do-completion): Correct case when completion is unambiguous. diff -r 04760bc22f94 -r 9b2f88075647 lisp/complete.el --- a/lisp/complete.el Wed Jan 28 15:34:22 2009 +0000 +++ b/lisp/complete.el Wed Jan 28 15:34:32 2009 +0000 @@ -737,8 +737,6 @@ (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 @@ (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))