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: Tue, 05 Jun 2007 07:56:19 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1181064138 32283 80.91.229.12 (5 Jun 2007 17:22:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Jun 2007 17:22:18 +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 19:22:16 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 1HvcjY-0005BC-AG for ged-emacs-devel@m.gmane.org; Tue, 05 Jun 2007 19:22:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HvcjX-0004xU-Kq for ged-emacs-devel@m.gmane.org; Tue, 05 Jun 2007 13:22:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HvaSc-0008PY-VB for emacs-devel@gnu.org; Tue, 05 Jun 2007 10:56:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HvaSc-0008PK-80 for emacs-devel@gnu.org; Tue, 05 Jun 2007 10:56:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HvaSc-0008PD-46 for emacs-devel@gnu.org; Tue, 05 Jun 2007 10:56:38 -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 1HvaSb-00024M-Ep for emacs-devel@gnu.org; Tue, 05 Jun 2007 10:56:37 -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 l55EuXoF050878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Jun 2007 07:56:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; s=2007001; d=ucsd.edu; c=simple; q=dns; b=X9Y96TEmfzTcKbgfwJNM5CgdzR/O7ohNffjBfPp+hWPsjTahb97Vbidu6yit0IWwH GQ4WwOgnBCdjl9AdDfP3g== Original-Received: from mister-foo.local ([128.54.220.221]) by smtp.ucsd.edu (8.13.6/8.13.4) with ESMTP id l55EuW4m029802; Tue, 5 Jun 2007 07:56:33 -0700 (PDT) In-Reply-To: (Leo's message of "Tue\, 05 Jun 2007 11\:39\:37 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) X-detected-kernel: FreeBSD 6.x (1) X-Mailman-Approved-At: Tue, 05 Jun 2007 13:22:12 -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:72282 Archived-At: --=-=-= Leo writes: > Reproduce: > 1. emacs -Q > 2. M-x partial-completion-mode > 3. M-: and then type in minibuffer `(emacs)' > 4. Move the cursor to be on ")" and hit "M-TAB" Thanks. Please try this version instead. /s --=-=-= Content-Disposition: attachment Index: complete.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v retrieving revision 1.72 diff -p -u -w -r1.72 complete.el --- complete.el 14 Apr 2007 20:23:31 -0000 1.72 +++ complete.el 5 Jun 2007 14:54:14 -0000 @@ -454,6 +454,7 @@ GOTO-END is non-nil, however, it instead env-on regex p offset + abbreviated (poss nil) helpposs (case-fold-search completion-ignore-case)) @@ -590,17 +591,23 @@ GOTO-END is non-nil, however, it instead pred nil)) ;; Find an initial list of possible completions - (if (not (setq p (string-match (concat PC-delim-regex + (unless (setq p (string-match (concat PC-delim-regex (if filename "\\|\\*" "")) str - (+ (length dirname) offset)))) + (+ (length dirname) offset))) ;; Minibuffer contains no hyphens -- simple case! - (setq poss (all-completions (if env-on - basestr str) + (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 p ;; 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,12 +616,17 @@ GOTO-END is non-nil, however, it instead 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 (set-text-properties 0 (length (car p)) '() (car p)) (setq poss (cons (car p) poss)))) - (setq p (cdr p))))) + (setq p (cdr p)))) ;; If table had duplicates, they can be here. (delete-dups poss) @@ -648,6 +660,7 @@ GOTO-END is non-nil, however, it instead (and p (setq poss p)))) ;; Now we have a list of possible completions + (cond ;; No valid completions found @@ -657,6 +670,9 @@ GOTO-END is non-nil, however, it instead (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 +873,11 @@ only symbols with function definitions a 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 + (skip-syntax-forward "_w") + (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 --=-=-=--