From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Howard Melman Newsgroups: gmane.emacs.bugs Subject: bug#38614: 26.3; Info completions in reverse order Date: Sun, 15 Dec 2019 14:39:16 -0500 Message-ID: References: <83mubt60an.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="150041"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38614@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 15 20:40:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1igZkW-000crO-3R for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Dec 2019 20:40:16 +0100 Original-Received: from localhost ([::1]:42270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igZkU-0004Qd-AL for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Dec 2019 14:40:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igZkK-0004KU-4q for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 14:40:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igZkI-0007Tr-Mf for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 14:40:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59387) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igZkI-0007Sf-HC for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 14:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1igZkI-0002TD-Ci for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 14:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Howard Melman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2019 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38614 X-GNU-PR-Package: emacs Original-Received: via spool by 38614-submit@debbugs.gnu.org id=B38614.15764387659443 (code B ref 38614); Sun, 15 Dec 2019 19:40:02 +0000 Original-Received: (at 38614) by debbugs.gnu.org; 15 Dec 2019 19:39:25 +0000 Original-Received: from localhost ([127.0.0.1]:37127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igZjh-0002SF-49 for submit@debbugs.gnu.org; Sun, 15 Dec 2019 14:39:25 -0500 Original-Received: from mail-qt1-f171.google.com ([209.85.160.171]:41862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igZjf-0002S2-LO for 38614@debbugs.gnu.org; Sun, 15 Dec 2019 14:39:24 -0500 Original-Received: by mail-qt1-f171.google.com with SMTP id k40so234810qtk.8 for <38614@debbugs.gnu.org>; Sun, 15 Dec 2019 11:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NNXqUEuWNGmsR6siqhrGfzPo+y05wxAKLzQiEQE4Fxs=; b=drt1vEfhHWf3aYqydynrA1EeGJNWgu86lQzRqgUR6nwZduRb2SjRGnUMxeqW5gHuA3 gHaSnbdOWQdmxrRTXIWEycDp9aHNvMVCVl1VJ1hpvssPwm62BhGGIYI55m5hje0U/nxg XsZCkt0lZMuQw7nxNUU5n5wUm2J5YNeUtJDS4zkHwGn5u7O0dcJEVI69nCvZA5iY5oNs FfllTtKzGF4IMxZyTW9VL63GE7rWnvlyenvMmAZPt7VTwwp6rDm39ZAZwqrTc8kgWd/I fbBr4mnM/x9YI321DnhuIUl6lgxd2DB3a0AJHNT6JutdfhxCaoKCREiWoJze7JXn5Rud r3lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NNXqUEuWNGmsR6siqhrGfzPo+y05wxAKLzQiEQE4Fxs=; b=hDLa0KOMFD+tQD4yMTuZyHUqHkJ4sRtRyqgM0Q1d6XGGxBLSTUS3tuSTpNotLBhbx3 ZQFkLRc765N94otUjNwAiTgf/zG3D6PtuvRG0i7Xotf0gqGDosS+8Dl3nMGPZlMWx8XL CPJcBw5oBwFuqrVOx9x0c4YH3IFBswGj6cObNg4ZE4okW5P9v77Iih2JrvYXE7wSd1sn s2ePkQOnRJ3AlSDnYCtFpZTKJ6GN4fvdPZF3MqMpAwHEoZSqoQGHfDvTvZTPgzK8jAa7 FfT+4TRhS6tHWZEabTOa/hQx6nrkLPKY6fNkfTG6D2UB0IVTRuhxAO7hO8VRTO5v+GeD qibw== X-Gm-Message-State: APjAAAVOiMML4zLJSJUI4R12e/trB0Ok0gMhEM6pLSzlhcT43+vO1JJD Q9P5oNoX/l7u37ElpTC9Uk6JvnE1 X-Google-Smtp-Source: APXvYqzT1fZ+XNxTpSLIxWjS7uIB67TogLOJwTzKD7Egys5NUnhheKmCBKVIVbpVfY2hxFRhuQTVKg== X-Received: by 2002:aed:3f88:: with SMTP id s8mr21977000qth.272.1576438758035; Sun, 15 Dec 2019 11:39:18 -0800 (PST) Original-Received: from lumet.home (pool-108-26-232-211.bstnma.fios.verizon.net. [108.26.232.211]) by smtp.gmail.com with ESMTPSA id t11sm5101036qkm.92.2019.12.15.11.39.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 11:39:17 -0800 (PST) In-Reply-To: <83mubt60an.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173381 Archived-At: (Sorry if this is a resend, I don't think I included debbugs in my = original reply) > On Dec 15, 2019, at 11:06 AM, Eli Zaretskii wrote: >=20 >> From: Howard Melman >> Date: Sat, 14 Dec 2019 12:18:54 -0500 >>=20 >> When using ivy mode, Info-index shows me the list of >> completions in reverse alphabetical order. Info-menu does too. >> Both Info-index and Info-menu use completing-read with >> Info-complete-menu-item as the collections argument. It >> seems to generate the list in reverse order. >>=20 >> Sorry this isn't a formatted patch, but a one line fix solves it for = me. >>=20 >> If after this line in Info-complete-menu-item: >> (setq completions (delete-dups completions)) >> I add this line: >> (setq completions (nreverse completions)) >> the index and menus are shown in alphabetical order. >=20 > Sorry, I don't understand: when I type "i SUBJECT" and press TAB in > Info, I get completions in alphabetical order, so how come with ivy > you get the reverse order? I tried that in Emacs 26.3 with -Q and and I see an alphabetical list. = I'm not sure what mechanism that's using and I don't particularly know = icomplete or ido, though I tried enabling each and saw the same = alphabetical list.=20 Note that's not quite the same thing as I was describing. Ivy has two = sort mechanisms. Ivy displays a list of possible completions (from the = collections argument of completing-read) BEFORE you enter any text = (SUBJECT in your case). There's no need to hit TAB to see the = completions. Then after you enter text it displays completions that are = sorted via a different mechanism (because the various matching = mechanisms and what you type might indicate a different sort order from = the original completions list such as: shorter matches first, prefix = matches first, or just alphabetical). AFAIK, Ivy usually doesn't do a = sort of the initial list because often it's in a useful order other than = alphabetical. It's clearer in the Info-menu case, where my desired order is the order = of the menu items in the info buffer. Using emacs -Q, Info-menu and TAB = shows me an alphabetical list. That tells me that whatever mechanism = it's using is sorting the list alphabetically and not using the original = order of the collection list.=20 Ivy shows me the menu items in reverse buffer order because the original = collection list presented to ivy (via completing-read) is in reverse = order as found in the buffer. Info-complete-menu-item is clearly pushing = onto a list and then not nreversing it as is the common idiom.=20 I got a bit lost following the elisp docs for Programmed Completion but = didn't see any guidelines about the order of the collections intially = returned (Info-complete-menu-item doesn't seem to be setting a = display-sort-function which I think is the mechanism but I got lost). Info uses the same function to build the collection list for both = Info-menu and Info-index. In the Info-index case the order from the = buffer is alphabetical, so Info-complete-menu-item is returning a = collection list in reverse alphabetical order.=20 Info-complete-menu-item is saving the cost of an nreverse. It would be = useful if it returned the items in the order as found in the buffer, = because that order isn't always easily recreated after sorting. In the = Info-menu case, that's a logical order of the menu items. In the = Info-index case, that happens to be alphabetical without the need for an = additional sort. buffer-list returns the buffers in most recently displayed order because = it's useful. I think Info-complete-menu-item should return it's items in = a logical order too (and not the reverse of one) even if some popular = completion mechanisms hide this by always sorting the list = alphabetically before display.=20 Ivy seems to show other initial completions in a useful order, to me it = seems only it's display of Info commands is wrong, because of this = missing idomatic nreverse. Howard=