From: "Sean O'Rourke" <sorourke@cs.ucsd.edu>
To: Leo <sdl.web@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: For after-the-release: enhanced partial completion
Date: Mon, 04 Jun 2007 14:33:12 -0700 [thread overview]
Message-ID: <m2vee3z9pj.fsf@cs.ucsd.edu> (raw)
In-Reply-To: m2k5ujac0f.fsf@sl392.st-edmunds.cam.ac.uk
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
Leo <sdl.web@gmail.com> 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
[-- Attachment #2: Type: text/plain, Size: 3191 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-06-04 21:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
[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=m2vee3z9pj.fsf@cs.ucsd.edu \
--to=sorourke@cs.ucsd.edu \
--cc=emacs-devel@gnu.org \
--cc=sdl.web@gmail.com \
/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).