GNU bug report logs -
#24676
25.1; `completion-pcm-all-completions' should not reverse order of candidates
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Wed, 12 Oct 2016 16:57:01 UTC
Severity: minor
Tags: fixed
Merged with 26313
Found in version 25.1
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24676 in the body.
You can then email your comments to 24676 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Wed, 12 Oct 2016 16:57:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 12 Oct 2016 16:57:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Because of this part, at the end of the function,
`completion-pcm-all-completions' reverses the order of the candidates.
(let ((poss ()))
(dolist (c compl)
(when (string-match-p regex c) (push c poss))) ; <==== reverses
poss)
It should not do this. Users should be able to depend on whatever order
the candidates are already in (as returned by `all-completions').
For example, for buffer candidates, the default order from
`all-completions' is last-display-time order.
The fix is trivial:
(let ((poss ()))
(dolist (c compl)
(when (string-match-p regex c) (push c poss)))
(nreverse poss))
In GNU Emacs 25.1.1 (x86_64-w64-mingw32)
of 2016-09-17
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --without-dbus --without-compress-install CFLAGS=-static'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Mon, 17 Oct 2016 08:21:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 24676 <at> debbugs.gnu.org (full text, mbox):
Hello,
> Because of this part, at the end of the function,
> `completion-pcm-all-completions' reverses the order of the candidates.
>
> (let ((poss ()))
> (dolist (c compl)
> (when (string-match-p regex c) (push c poss))) ; <==== reverses
> poss)
>
> It should not do this. Users should be able to depend on whatever order
> the candidates are already in (as returned by `all-completions').
>
> For example, for buffer candidates, the default order from
> `all-completions' is last-display-time order.
>
> The fix is trivial:
>
> (let ((poss ()))
> (dolist (c compl)
> (when (string-match-p regex c) (push c poss)))
> (nreverse poss))
Ah, this is the reason for the candidate list reversion I see. Yes,
this should IMO not happen.
Stefan, if you get the time, can you please have a look at whether the
suggested fix looks ok to you, and commit it if applicable?
Thanks,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Mon, 17 Oct 2016 16:32:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 24676 <at> debbugs.gnu.org (full text, mbox):
> Because of this part, at the end of the function,
> `completion-pcm-all-completions' reverses the order of the candidates.
completion-pcm-all-completions doesn't have any such code.
After searching a bit I decided you meant completion-pcm--all-completions.
> (let ((poss ()))
> (dolist (c compl)
> (when (string-match-p regex c) (push c poss)))
> (nreverse poss))
Looks good, please install,
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Tue, 18 Oct 2016 08:12:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 24676 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> completion-pcm-all-completions doesn't have any such code. After
> searching a bit I decided you meant completion-pcm--all-completions.
Oh yes, I found that too, but forgot to mention.
>
> > (let ((poss ()))
> > (dolist (c compl)
> > (when (string-match-p regex c) (push c poss)))
> > (nreverse poss))
>
> Looks good, please install,
This doesn't seem to meet any of the criteria in
http://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00007.html
so I think I'll have to commit to master.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Tue, 18 Oct 2016 13:57:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 24676 <at> debbugs.gnu.org (full text, mbox):
> > > (let ((poss ()))
> > > (dolist (c compl)
> > > (when (string-match-p regex c) (push c poss)))
> > > (nreverse poss))
> >
> > Looks good, please install,
>
> This doesn't seem to meet any of the criteria in
> http://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00007.html
> so I think I'll have to commit to master.
Thanks for fixing this, Michael.
Unfortunately, there is no way for my code that compensates for this bug to now know whether/when it has been fixed. No simple test such as `fboundp' or an Emacs version.
Of course, if you happened to decide to rename the function, there would be no problem...
And it's already a bit much that there is also a function `completion-pcm-all-completions' that does not even call `completion-pcm--all-completions', and that has a completely different signature. And the "internal" function has a nice doc string, but the "external" one has no doc string...
Perhaps you would consider taking this opportunity to find a better name for this "internal" function? Especially since it is "internal", probably few 3rd-party libraries would be affected by a name change.
In my case, I would not be referencing this "internal" function at all, except that I needed to work around this bug. If you did choose to rename it, I would not need to make any code changes, because I already protect this change with `(when (fboundp 'completion-pcm--all-completions)...)'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24676
; Package
emacs
.
(Tue, 18 Oct 2016 14:23:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 24676 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> Unfortunately, there is no way for my code that compensates for this
> bug to now know whether/when it has been fixed. No simple test such
> as `fboundp' or an Emacs version.
>
> Of course, if you happened to decide to rename the function, there
> would be no problem...
Hmm, that sounds reasonable. If nobody objects, I can do that, sure.
Michael.
Forcibly Merged 24676 26313.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Thu, 30 Mar 2017 19:04:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Wed, 21 Jun 2017 02:50:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
24676 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com>
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Wed, 21 Jun 2017 02:50:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 19 Jul 2017 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 339 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.