unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* For after-the-release: enhanced partial completion
@ 2007-02-17  5:39 Sean O'Rourke
  2007-06-04 15:26 ` Leo
  2007-06-04 16:09 ` Leo
  0 siblings, 2 replies; 19+ messages in thread
From: Sean O'Rourke @ 2007-02-17  5:39 UTC (permalink / raw)
  To: emacs-devel

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<tab>".  With this change, you can type "mvbl<tab>".  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

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2007-06-10 23:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-17  5:39 For after-the-release: enhanced partial completion Sean O'Rourke
2007-06-04 15:26 ` Leo
2007-06-04 16:09 ` Leo
2007-06-04 16:19   ` Sean O'Rourke
2007-06-04 17:02     ` Leo
2007-06-04 21:33       ` Sean O'Rourke
     [not found]         ` <m2wsyjbd7a.fsf@sl392.st-edmunds.cam.ac.uk>
2007-06-04 22:10           ` Sean O'Rourke
2007-06-04 22:20           ` Sean O'Rourke
2007-06-05  6:40             ` Leo
2007-06-05 10:39             ` Leo
2007-06-05 14:56               ` Sean O'Rourke
2007-06-05 15:32                 ` Leo
2007-06-06  2:12                   ` Sean O'Rourke
2007-06-07  1:46                     ` Leo
2007-06-07  4:08                       ` Sean O'Rourke
2007-06-08 11:57                         ` unicode-2 fail to bootstrap (was: For after-the-release: enhanced partial completion) Leo
2007-06-10 13:53                           ` unicode-2 fail to bootstrap Sean O'Rourke
2007-06-10 23:42                           ` unicode-2 fail to bootstrap (was: For after-the-release: enhanced partial completion) Kenichi Handa
2007-06-04 19:27     ` For after-the-release: enhanced partial completion Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).