From: Sean O'Rourke <sorourke@cs.ucsd.edu>
To: emacs-devel@gnu.org
Subject: For after-the-release: enhanced partial completion
Date: Fri, 16 Feb 2007 21:39:10 -0800 [thread overview]
Message-ID: <m2fy95wdfl.fsf@cs.ucsd.edu> (raw)
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
next reply other threads:[~2007-02-17 5:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-17 5:39 Sean O'Rourke [this message]
2007-06-04 15:26 ` For after-the-release: enhanced partial completion 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2fy95wdfl.fsf@cs.ucsd.edu \
--to=sorourke@cs.ucsd.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).