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: For after-the-release: enhanced partial completion Date: Fri, 16 Feb 2007 21:39:10 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1171690790 26026 80.91.229.12 (17 Feb 2007 05:39:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 17 Feb 2007 05:39:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 17 06:39:44 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 1HIIIS-0006iM-8z for ged-emacs-devel@m.gmane.org; Sat, 17 Feb 2007 06:39:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HIIIR-0005Gw-Rh for ged-emacs-devel@m.gmane.org; Sat, 17 Feb 2007 00:39:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HIIIF-0005Gf-QB for emacs-devel@gnu.org; Sat, 17 Feb 2007 00:39:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HIIIE-0005GL-EV for emacs-devel@gnu.org; Sat, 17 Feb 2007 00:39:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HIIIE-0005GI-5u for emacs-devel@gnu.org; Sat, 17 Feb 2007 00:39:30 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HIIID-0000Eb-NY for emacs-devel@gnu.org; Sat, 17 Feb 2007 00:39:30 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HIII2-00050i-Cg for emacs-devel@gnu.org; Sat, 17 Feb 2007 06:39:18 +0100 Original-Received: from rh-ip-0416-res.resnet.ucsd.edu ([128.54.220.221]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Feb 2007 06:39:18 +0100 Original-Received: from sorourke by rh-ip-0416-res.resnet.ucsd.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Feb 2007 06:39:18 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 75 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: rh-ip-0416-res.resnet.ucsd.edu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (darwin) Cancel-Lock: sha1:oy0tbMpJL+um+Y2Eo87l7th8rIU= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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:66473 Archived-At: For quite awhile, I've been using the attached local change to `PC-do-completion' to reduce the amount of typing required for completing lisp symbols. Basically, if no completions are found, `PC-do-completion' assumes that the user input is an abbreviation. For example, say you want help on `make-variable-buffer-local'. Currently, you have to type "m-v-b-l". With this change, you can type "mvbl". Has anyone else done something similar/better? Does anyone else find this useful? /s Index: complete.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v retrieving revision 1.59 diff -u -r1.59 complete.el --- complete.el 21 Jan 2007 03:53:12 -0000 1.59 +++ complete.el 17 Feb 2007 05:30:17 -0000 @@ -396,6 +396,7 @@ (ambig nil) basestr origstr env-on + unexploded regex p offset (poss nil) @@ -527,17 +528,26 @@ 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) + (setq + unexploded str + str (mapconcat #'list str "-") + regex (concat "\\`" (replace-regexp-in-string "-" "[^-]*-" str)) + p 1) + (goto-char beg) + (delete-region beg end) + (setq end (+ beg (length str))) + (insert str))) + (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 @@ -546,6 +556,9 @@ table pred))) (setq p compl) + (when (and unexploded (not compl)) + (setq str unexploded + p nil)) (while p (and (string-match regex (car p)) (progn