From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sean O'Rourke" Newsgroups: gmane.emacs.devel Subject: Re: For after-the-release: enhanced partial completion Date: Mon, 04 Jun 2007 14:33:12 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1181012551 21895 80.91.229.12 (5 Jun 2007 03:02:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Jun 2007 03:02:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 05 05:02:29 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HvPJU-00079S-6I for ged-emacs-devel@m.gmane.org; Tue, 05 Jun 2007 05:02:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HvPJT-0001kn-JN for ged-emacs-devel@m.gmane.org; Mon, 04 Jun 2007 23:02:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HvKBC-0004nr-3W for emacs-devel@gnu.org; Mon, 04 Jun 2007 17:33:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HvKBA-0004mt-9g for emacs-devel@gnu.org; Mon, 04 Jun 2007 17:33:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HvKBA-0004mm-40 for emacs-devel@gnu.org; Mon, 04 Jun 2007 17:33:32 -0400 Original-Received: from outbound1.ucsd.edu ([132.239.1.205]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HvKB9-00080O-Iw for emacs-devel@gnu.org; Mon, 04 Jun 2007 17:33:31 -0400 Original-Received: from smtp.ucsd.edu (smtp.ucsd.edu [132.239.1.49]) by outbound1.ucsd.edu (8.13.6/8.13.6) with ESMTP id l54LXPid094793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Jun 2007 14:33:26 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; s=2007001; d=ucsd.edu; c=simple; q=dns; b=Z3eJS60LE09/39YQR7P0qV66c8BOTkQMzlF3CZeYtj2mPP8up9BJ1KN22brw52bvy 3XGyMGFkzhnd97ZTgCQrA== Original-Received: from mister-foo.local ([128.54.220.221]) by smtp.ucsd.edu (8.13.6/8.13.4) with ESMTP id l54LXOCK015200; Mon, 4 Jun 2007 14:33:25 -0700 (PDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) X-detected-kernel: FreeBSD 6.x (1) X-Mailman-Approved-At: Mon, 04 Jun 2007 23:02:24 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72249 Archived-At: --=-=-= Leo writes: > Tried your new patch. It doesn't work for me. For example, when I typed > 'M-x e l m TAB', it didn't expand to "e-l-m". Is this > intended? Yes, it was. My feeling was that this kind of completion is sort of a guess, so moving the point and inserting "-" would more likely be annoying rather than helpful. Having used it more, though, I think doing the expansion might be best. Does the attached patch do the right thing? I think it has the desired behavior: if "xyz" has multiple completions, it behaves just like "x-y-z", but if it has none, both point and "xyz" are left intact. However PC-do-completions, at 392 lines, is somewhat frightening, so I may have done something wrong. As unrelated issue, I noticed that PC-lisp-complete-symbol could stand to be improved. Try this: (insert "(mvb") (PC-lisp-complete-symbol) (insert "u") (PC-lisp-complete-symbol) There's already a commented-out version of the fix in complete.el, which should probably be enabled. /s --=-=-= Content-Disposition: attachment Index: complete.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v retrieving revision 1.72 diff -u -r1.72 complete.el --- complete.el 14 Apr 2007 20:23:31 -0000 1.72 +++ complete.el 4 Jun 2007 21:31:54 -0000 @@ -454,6 +454,7 @@ env-on regex p offset + abbreviated (poss nil) helpposs (case-fold-search completion-ignore-case)) @@ -590,17 +591,23 @@ pred nil)) ;; Find an initial list of possible completions - (if (not (setq p (string-match (concat PC-delim-regex - (if filename "\\|\\*" "")) - str - (+ (length dirname) offset)))) - - ;; Minibuffer contains no hyphens -- simple case! - (setq poss (all-completions (if env-on - basestr str) - table - pred)) - + (unless (setq p (string-match (concat PC-delim-regex + (if filename "\\|\\*" "")) + str + (+ (length dirname) offset))) + + ;; Minibuffer contains no hyphens -- simple case! + (setq poss (all-completions (if env-on basestr str) + table + pred)) + (unless (or filename poss) + ;; Try completion as an abbreviation, e.g. "mvb" -> "m-v-b" + ;; -> "multiple-value-bind" + (setq regex (concat "\\`" (mapconcat #'list str "[^-]*-")) + origstr str + p 1 + abbreviated t))) + (when (or p abbreviated) ;; Use all-completions to do an initial cull. This is a big win, ;; since all-completions is written in C! (let ((compl (all-completions (if env-on @@ -609,6 +616,11 @@ table pred))) (setq p compl) + (when (and compl abbreviated) + (setq basestr (mapconcat 'list str "-")) + (delete-region beg end) + (setq end (+ beg (length basestr))) + (insert basestr))) (while p (and (string-match regex (car p)) (progn @@ -657,6 +669,9 @@ (let ((PC-word-failed-flag t)) (delete-backward-char 1) (PC-do-completion 'word)) + (when abbreviated + (delete-region beg end) + (insert origstr)) (beep) (PC-temp-minibuffer-message (if ambig " [Ambiguous dir name]" @@ -857,13 +872,11 @@ Otherwise, all symbols with function definitions, values or properties are considered." (interactive) - (let* ((end (point)) - ;; To complete the word under point, rather than just the portion - ;; before point, use this: -;;; (save-excursion -;;; (with-syntax-table lisp-mode-syntax-table -;;; (forward-sexp 1) -;;; (point)))) + (let* ((end + (save-excursion + (with-syntax-table lisp-mode-syntax-table + (forward-sexp 1) + (point)))) (beg (save-excursion (with-syntax-table lisp-mode-syntax-table (backward-sexp 1) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--