From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Ashutosh Mehra <ashutoshmehra@gmail.com>,
2957@emacsbugs.donarmstrong.com
Subject: bug#2957: 23.0.92; ucs-insert: Completion does not work correctly with Unicode Character Name Input
Date: Sat, 11 Apr 2009 09:57:36 -0400 [thread overview]
Message-ID: <jwvab6n1h66.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <m2eivzttms.fsf@igel.home> (Andreas Schwab's message of "Sat, 11 Apr 2009 11:41:15 +0200")
>> BUG DESCRIPTION:
>> When I type the following:
>> C-x 8 RET greek letter alpha
>> and press TAB, I get several choices for the greek letter alpha
>> variants. But I'm unable to type anything into the minibuffer (neither
>> SPC nor any character) -- Emacs just doesn't accept the input.
I understand that SPC would signal an error, but any normal character
should be inserted in the minibuffer just fine. Do you really mean that
you can't type anything in the minibuffer, or just that anything you
type will later lead to a completion failure or to the error you mention:
>> If I press RET at this point, I get the error message "ucs-insert:
>> Not a Unicode character code: nil".
That looks like a (minor) bug indeed.
> This is a problem with partial-completion.
> (completing-read "Type a SPC b TAB: "
> '("a 1 b" "a 1 b c" "a 1 b d" "a 2 b" "a 2 b c" "a 2 b d"))
> The minibuffer contents become "a SPC SPC b", indicating that a word is
> missing between "a" and "b". Either partial-completion should move
> point back to where the word is missing or accept SPC as input.
Actually, it's a problem with minibuffer-complete-word which sometimes
wants partial completion and sometimes doesn't.
The patch below provides an alternative way to choose between using
partial-completion and not, which is finer-grained and should fix the
above problem without reintroducing the problems it tried to fix,
Stefan
=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el 2009-03-19 04:24:15 +0000
+++ lisp/minibuffer.el 2009-04-11 13:51:07 +0000
@@ -780,13 +780,13 @@
;; If completion finds next char not unique,
;; consider adding a space or a hyphen.
(when (= (length string) (length (car comp)))
- (let ((exts '(" " "-"))
+ ;; Mark the added char with the `completion-word' property, so it
+ ;; can be handled specially by completion styles such as
+ ;; partial-completion.
+ (let ((exts (mapcar (lambda (str) (propertize str 'completion-word t))
+ '(" " "-")))
(before (substring string 0 point))
(after (substring string point))
- ;; Disable partial-completion for this.
- (completion-styles
- (or (remove 'partial-completion completion-styles)
- completion-styles))
tem)
(while (and exts (not (consp tem)))
(setq tem (completion-try-completion
@@ -1598,7 +1598,13 @@
(p 0)
(p0 p))
- (while (setq p (string-match completion-pcm--delim-wild-regex string p))
+ (while (and (setq p (string-match completion-pcm--delim-wild-regex
+ string p))
+ ;; If the char was added by minibuffer-complete-word, then
+ ;; don't treat it as a delimiter, otherwise "M-x SPC"
+ ;; ends up inserting a "-" rather than listing
+ ;; all completions.
+ (not (get-text-property p 'completion-word string)))
;; Usually, completion-pcm--delim-wild-regex matches a delimiter,
;; meaning that something can be added *before* it, but it can also
;; match a prefix and postfix, in which case something can be added
next prev parent reply other threads:[~2009-04-11 13:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <jwvfxgcufla.fsf-monnier+emacsbugreports@gnu.org>
2009-04-11 2:52 ` bug#2957: 23.0.92; ucs-insert: Completion does not work correctly with Unicode Character Name Input Ashutosh Mehra
2009-04-11 9:41 ` Andreas Schwab
2009-04-11 13:57 ` Stefan Monnier [this message]
2009-04-13 7:42 ` Ashutosh Mehra
2009-04-14 2:45 ` bug#2957: marked as done (23.0.92; ucs-insert: Completion does not work correctly with Unicode Character Name Input) Emacs bug Tracking System
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=jwvab6n1h66.fsf-monnier+emacsbugreports@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=2957@emacsbugs.donarmstrong.com \
--cc=ashutoshmehra@gmail.com \
--cc=schwab@linux-m68k.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).