From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Denis Howe Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#1976: 23.0.50; PC-do-completion should fix case if possible Date: Wed, 21 Jan 2009 14:42:43 +0000 Message-ID: References: Reply-To: Denis Howe , 1976@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e6d460a725c8ff0460ff2b02 X-Trace: ger.gmane.org 1232572615 7224 80.91.229.12 (21 Jan 2009 21:16:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Jan 2009 21:16:55 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 21 22:18:07 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LPkSa-00010m-N9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Jan 2009 22:18:07 +0100 Original-Received: from localhost ([127.0.0.1]:44292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPkRJ-0003qH-AC for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Jan 2009 16:16:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPec7-0007BE-V4 for bug-gnu-emacs@gnu.org; Wed, 21 Jan 2009 10:03:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPec7-0007As-3d for bug-gnu-emacs@gnu.org; Wed, 21 Jan 2009 10:03:31 -0500 Original-Received: from [199.232.76.173] (port=54530 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPec6-0007Ap-UV for bug-gnu-emacs@gnu.org; Wed, 21 Jan 2009 10:03:31 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:34293) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LPec5-0007ZW-WA for bug-gnu-emacs@gnu.org; Wed, 21 Jan 2009 10:03:30 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0LF3SOW006158; Wed, 21 Jan 2009 07:03:28 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0LEt4X8003875; Wed, 21 Jan 2009 06:55:04 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Denis Howe Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 21 Jan 2009 14:55:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 1976 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12325491212468 (code B ref -1); Wed, 21 Jan 2009 14:55:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 21 Jan 2009 14:45:21 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0LEjHkI002462 for ; Wed, 21 Jan 2009 06:45:18 -0800 Original-Received: from mx10.gnu.org ([199.232.76.166]:57013) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LPeJ0-0008DB-7d for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 09:43:46 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LPeKQ-0004zQ-0M for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 09:45:16 -0500 Original-Received: from mail-bw0-f10.google.com ([209.85.218.10]:45005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPeKP-0004zA-2V for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 09:45:13 -0500 Original-Received: by bwz3 with SMTP id 3so234229bwz.18 for ; Wed, 21 Jan 2009 06:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=kGYds7ECNK83YNSczDJHh59ocnKT0t43Y07c2u+6DzU=; b=xbZ/09oeXyaJwqb9C88MRDpeXcNrIN+5e13d+BgEQqaofIr0QUbcbIzfgA6J4QRYmk h5L4OAGLYZaRa5YbuzAbLOEX//fT/+MnhktcHcUllEA9UcFRyY4P0S8bFcglQ6FtE+os 3uLuQRSnmm00g5vPeOBKOWo7kBgNIorAdZ5/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=yHnYoxLB9kiDYKZI8lIoYvbRmAwfuF8KfRLqGgkXDfGuqxPbFCOcl41YAymhWWMiI1 LK98aAGOXvaXhVrhT+Ms7AxBf9IR2beo9gL2a7Ii8B2cMlXEZpCQOQRPIEpRzsNvTIyJ b37qxPjjn9OaDrn6IhIZemY3HbkTu0YNBDf84= Original-Received: by 10.181.225.6 with SMTP id c6mr2911498bkr.207.1232548963665; Wed, 21 Jan 2009 06:42:43 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 21 Jan 2009 10:03:31 -0500 X-Mailman-Approved-At: Wed, 21 Jan 2009 16:15:21 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24362 gmane.emacs.pretest.bugs:23727 Archived-At: --0016e6d460a725c8ff0460ff2b02 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit My 2007-10-03 attempt to get this patch applied got no further than RMS's request for someone to DTRT. It took several hours of my time to debug and test, and the bug still bites me every time I re-install, so PLEASE could someone apply it? Thanks. ------------------------------------------------------------ In the latest complete.el from CVS (v1.94), function "PC-do-completion" fails to correct the case of the input being completed when: - "completion-ignore-case" is true and - "read-file-name-completion-ignore-case" is true and - all possible completions have the same case Ordinary completion preserves input case only where the potential completions differ in case. If they agree then ordinary completion changes the input case to that of the prefix. For example, evaluate: (partial-completion-mode 0) (setq completion-ignore-case t) (completing-read "Input: " '(("Den".1)("Denis".2)) nil t "d") Hitting TAB runs ordinary "minibuffer-complete" which completes "d" to "Den" (case corrected). Enable partial completion: (partial-completion-mode 1) Re-evaluate the above completing-read. Hitting TAB now runs "PC-complete" which completes "d" to "den" (fails to correct input case). I've tested the attached patch thoroughly. Please contact me if you want any more background on this. ------------------------------------------------------------ ChangeLog entry: 2009-01-21 Denis Howe * complete.el (PC-do-completion): Correct case when unambiguous. ------------------------------------------------------------ cvs diff -cw complete.el Index: complete.el =================================================================== RCS file: /sources/emacs/emacs/lisp/complete.el,v retrieving revision 1.94 diff -c -w -r1.94 complete.el *** complete.el 9 Jan 2009 04:44:19 -0000 1.94 --- complete.el 21 Jan 2009 14:21:17 -0000 *************** *** 737,744 **** (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))) --- 737,742 ---- *************** *** 746,760 **** (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)))) --- 744,757 ---- (setq i 0) ; index into prefix string (while (< i (length prefix)) (if (and (< (point) end) + (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 (delete-char 1) (insert (substring prefix i (1+ i)))) *************** *** 766,772 **** (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)) --- 763,769 ---- (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)) ------------------------------------------------------------ End -- Denis Howe --0016e6d460a725c8ff0460ff2b02 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable My 2007-10-03 attempt to get this patch applied got no further than RMS'= ;s request for someone to DTRT.  It took several hours of my time to d= ebug and test, and the bug still bites me every time I re-install, so PLEAS= E could someone apply it?  Thanks.
------------------------------------------------------------
In the latest complete.el from CVS (v1.94), function "PC-do-comple= tion" fails to correct the case of the input being completed when:

- "completion-ignore-case" is true and
- "read-file-name-completion-ignore-case" is true and
- all possible completions have the same case

Ordinary completion preserves input case only where the potential completio= ns differ in case.  If they agree then ordinary completion changes the= input case to that of the prefix.

For example, evaluate:

(partial-completion-mode 0)
(setq completion-ignore-case t)
(completing-read "Input: " '(("Den".1)("Denis&= quot;.2)) nil t "d")

Hitting TAB runs ordinary "minibuffer-complete" which completes &= quot;d" to "Den" (case corrected).

Enable partial completion:

(partial-completion-mode 1)

Re-evaluate the above completing-read.

Hitting TAB now runs "PC-complete" which completes "d" = to "den" (fails to correct input case).

I've tested the attached patch thoroughly.  Please contact me if y= ou want any more background on this.

------------------------------------------------------------

ChangeLog entry:

2009-01-21  Denis Howe <den= is.howe@gmail.com>

       * complete.el (PC-do-completion): Correct case = when unambiguous.

------------------------------------------------------------

c= vs diff -cw complete.el
Index: complete.el
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /sources/emacs/emacs/lisp/complete= .el,v
retrieving revision 1.94
diff -c -w -r1.94 complete.el
*** complete.e= l    9 Jan 2009 04:44:19 -0000    1.94
---= complete.el    21 Jan 2009 14:21:17 -0000
**************= *
*** 737,744 ****
           = ;    (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 i= s set.
            (if (eq mode = 'word)
               = (setq prefix (PC-chop-word prefix basestr)))
      =       (goto-char (+ beg (length dirname)))
--- 737,7= 42 ----
***************
*** 746,760 ****
     =             (setq i 0) ; inde= x into prefix string
                = ;  (while (< i (length prefix))
       =              (if (and (< (p= oint) end)
            &nbs= p;            (eq (downcase (aref p= refix i))
!             &nb= sp;              (do= wncase (following-char))))
!               &nbs= p;       ;; same char (modulo case); no action
= !               &nbs= p;       (forward-char 1)
!     =                = (if (and (< (point) end)
         = ;               &nbs= p;  (and (looking-at " ")
            &nb= sp;            =             &nb= sp;            =   (memq (aref prefix i)
!         &nb= sp;               &n= bsp;   PC-delims-list)))
        = ;              ;; replace= " " by the actual delimiter
       &= nbsp;              (progn=
                = ;        (delete-char 1)
    &nb= sp;               &n= bsp;   (insert (substring prefix i (1+ i))))
--- 744,757 ----
&n= bsp;               &= nbsp; (setq i 0) ; index into prefix string
      &n= bsp;           (while (< i (leng= th prefix))
                = ;    (if (and (< (point) end)
+    &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp; (or
             = ;            (eq (downcase (aref pr= efix i))
!          &n= bsp;            = ;            &n= bsp;            = ; (downcase (following-char)))
                = ;           (and (looking-at "= ")
          &nb= sp;            =             &nb= sp;            =     (memq (aref prefix i)
!     =             &nb= sp;            =             &nb= sp;            = PC-delims-list))))
           &= nbsp;          ;; replace " " = by the actual delimiter
+            &n= bsp;            = ;            &n= bsp; ;; or input char by prefix char
       &nb= sp;              (progn               &nb= sp;        (delete-char 1)
    &= nbsp;               =     (insert (substring prefix i (1+ i))))
***************
*** 766,772 ****
         &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;  (setq end (1- end))))
        &nb= sp;             (setq improved= t)
           &n= bsp;            = ;            &n= bsp;     (insert (substring prefix i (1+ i)))
! &nbs= p;               &nb= sp;   (setq end (1+ end)))))
                = ;    (setq i (1+ i)))
        &n= bsp;         (or pt (setq pt (point)))
&nb= sp;               &n= bsp; (looking-at PC-delim-regex))
--- 763,769 ----
   =             &nb= sp;            =             &nb= sp;        (setq end (1- end))))
                = ;      (setq improved t)
    &nb= sp;            =             &nb= sp;            (inse= rt (substring prefix i (1+ i)))
!      &nb= sp;            =             &nb= sp;       (setq end (1+ end))))
  &nb= sp;               &n= bsp; (setq i (1+ i)))
                = ;  (or pt (setq pt (point)))
        =           (looking-at PC-delim-regex))
------------------------------------------------------------
End

-- Denis Howe <denis.howe@gmail.com>
<= br> --0016e6d460a725c8ff0460ff2b02--