* try-completion not showing all possible completions?
@ 2006-01-04 1:09 Chris Mears
2006-01-05 5:22 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Chris Mears @ 2006-01-04 1:09 UTC (permalink / raw)
Hello all,
Executing the following code:
(let ((table (make-vector 1021 0)))
(intern "johnny jones" table)
(intern "joe blow" table)
(intern "jimi hendrix" table)
(try-completion "j" table (lambda (s) (princ (format "%s\n" s)))))
I would expect the output to be all three names in the table. However,
in the current CVS Emacs it produces:
johnny jones
jimi hendrix
"j"
"joe blow" has been omitted. I tested the same code in Emacs 21.4.1 and
it does what I expected:
johnny jones
jimi hendrix
joe blow
"j"
Can anyone shed some light on this?
Thanks,
Chris Mears
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: try-completion not showing all possible completions?
2006-01-04 1:09 try-completion not showing all possible completions? Chris Mears
@ 2006-01-05 5:22 ` Stefan Monnier
2006-01-05 6:01 ` Chris Mears
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2006-01-05 5:22 UTC (permalink / raw)
Cc: emacs-devel
> (let ((table (make-vector 1021 0)))
> (intern "johnny jones" table)
> (intern "joe blow" table)
> (intern "jimi hendrix" table)
> (try-completion "j" table (lambda (s) (princ (format "%s\n" s)))))
> I would expect the output to be all three names in the table. However,
> in the current CVS Emacs it produces:
> johnny jones
> jimi hendrix
> "j"
> "joe blow" has been omitted. I tested the same code in Emacs 21.4.1 and
> it does what I expected:
> johnny jones
> jimi hendrix
> joe blow
> "j"
> Can anyone shed some light on this?
Simple optimization: after seeing johnny jones and jimi hendrix,
try-completion already knows that the return value will be "j", so it
doesn't look any further.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: try-completion not showing all possible completions?
2006-01-05 5:22 ` Stefan Monnier
@ 2006-01-05 6:01 ` Chris Mears
2006-01-05 16:27 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Chris Mears @ 2006-01-05 6:01 UTC (permalink / raw)
Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (let ((table (make-vector 1021 0)))
>> (intern "johnny jones" table)
>> (intern "joe blow" table)
>> (intern "jimi hendrix" table)
>> (try-completion "j" table (lambda (s) (princ (format "%s\n" s)))))
>
>> I would expect the output to be all three names in the table. However,
>> in the current CVS Emacs it produces:
>
>> johnny jones
>> jimi hendrix
>> "j"
[...]
> Simple optimization: after seeing johnny jones and jimi hendrix,
> try-completion already knows that the return value will be "j", so it
> doesn't look any further.
Thank you, that makes perfect sense. The documentation for
try-completion is a little misleading; it says:
"Each car of each element of ALIST (or each element if it is not a cons
cell) is tested to see if it begins with STRING."
I understood this to mean that the predicate (try-completion's third
argument) would be run on *each and every* element of ALIST.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: try-completion not showing all possible completions?
2006-01-05 6:01 ` Chris Mears
@ 2006-01-05 16:27 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2006-01-05 16:27 UTC (permalink / raw)
Cc: emacs-devel
> Thank you, that makes perfect sense. The documentation for
> try-completion is a little misleading; it says:
> "Each car of each element of ALIST (or each element if it is not a cons
> cell) is tested to see if it begins with STRING."
> I understood this to mean that the predicate (try-completion's third
> argument) would be run on *each and every* element of ALIST.
The predicate is definitely not used on each and every element of ALIST.
In older Emacsen it was called on each and every element that started with
STRING (tho it might also depend on completion-regexp-list) and now it's
called in slightly fewer cases.
Basically it's called whenever it's needed. Notice that the piece of
docstring you quote doesn't mention the predicate at all.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-01-05 16:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 1:09 try-completion not showing all possible completions? Chris Mears
2006-01-05 5:22 ` Stefan Monnier
2006-01-05 6:01 ` Chris Mears
2006-01-05 16:27 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.