From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: [External] : Re: Sorting command completions by recency Date: Wed, 17 Feb 2021 22:02:53 +0000 Message-ID: References: <875z2qslwk.fsf@mail.linkov.net> <877dn635oe.fsf@gnus.org> <87o8gifoci.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40350"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , "emacs-devel@gnu.org" To: Juri Linkov , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 17 23:03:53 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCUvJ-000APK-1m for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Feb 2021 23:03:53 +0100 Original-Received: from localhost ([::1]:46590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCUvI-0004Kf-2J for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Feb 2021 17:03:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCUuW-0003tJ-Iu for emacs-devel@gnu.org; Wed, 17 Feb 2021 17:03:04 -0500 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:60314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCUuT-0001ZL-U8 for emacs-devel@gnu.org; Wed, 17 Feb 2021 17:03:03 -0500 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11HM0ML1166650; Wed, 17 Feb 2021 22:02:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=8hoPzp6fWVveAa+EvtqaFkBDttNgMmkQs0GMrU5gFB0=; b=mk/YwQcB49xLPTbOpaMnXCRgSjFxUwdw0t/jcLdyq9d/GqAzL6x9/sX+QWpQ1N0QrGd4 sNUf7tub5U3mNK70RMr0m/3D18lHj+cZfJC8RnNpr8R3no2tNOtcflVQjpbG3BIQUr2N l1B8LG9d1tTNu3HjJtcNj68TYqCe23sylu3hJmy8x7yphqM77h/f0NS/dPaHLw4hCwyx 23cxdPLjdFT3Pj0Xz1H/82onK9fJ2pW2ITQbvo2rOFxaE/iV9a7c2MW9tLJLlyWW0w3C VjVEzVgnl4L3h+tj3q7Gj/20ldHwuQS8zkH9x/8TklW8ggABXPAxLYADydHgzLFfsrfc 0A== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49bc50g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 22:02:56 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11HM08Zm114482; Wed, 17 Feb 2021 22:02:55 GMT Original-Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2046.outbound.protection.outlook.com [104.47.74.46]) by userp3030.oracle.com with ESMTP id 36prpyp9vw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 22:02:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNqNcAlgHHniS8RB25F2iMS/2U0zdp1jU3n/xPrvswlrqUNy6wUVDBbLz+c//+DRVOENyQ5C86Xr5HwABqEGTsMcNjXFVM2iaBzpjFCOVujJtPcd4xN/xxPJkA0tvDCGdu8GxIM+Lgolfg8eQ+DM46+vvxzcu00rir6UanQ65umv1lulvmDrGrACQolDXHrNTMk3LRoKRmJufZEPi7Z0akFxBtQLCGZthzJfrBgllQBLAa8muP2Drhaid6U7cC5+1FbDCiyKdV0AMNIAhHxAm6PchZYXB6xaAPrDDm7eLHEHzSlhCzUfk9QSE2U9p7EhEHCQsoIqnYNAEAgELlvgNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8hoPzp6fWVveAa+EvtqaFkBDttNgMmkQs0GMrU5gFB0=; b=G4Orn65Wr0DaAGBQCYIgqU9WYxQa1g39pySgo/i8NLgRhO/6k8TR/DkOo6TXIA96cXzkf3XyPw0GkjjwR+DO9lHJAFkAthOt+libR+rBaGS/NhSPim0Va3zYdsGcUe+qkz5X2ob8GTd3rjiOwGDadnfZnrCj1Egp8/sVSwlTEiPw97QPmulyQA9rMTkX+/qSHbV1K/GF50A4RtvwJMdS/wqN77jpvEAeybtsLHS3TJxEstST1lXH1+Oahuutfh2elnXWzWfbqJGDVbNAJ9nGOvlocTxrb9iObvlQL7gtN9xD1/j7p8Hv1Z8kTBRCqZHPkzMMoqQelmekD8q2M4sAHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8hoPzp6fWVveAa+EvtqaFkBDttNgMmkQs0GMrU5gFB0=; b=TF4JFegshfbMOAZLqORkYmqcRmLlENyB8nNzrkYHBkW5xxizzH2uaSupcKPcXg0nAK5AKlzt+fJwkg90iT2ze4fz7dUCCyQnewJcvZ1lj0drAC9tsnoSOsCm8ZAfTyRxcUDgUHkOuQuL4PDK6aPwf2rEiTkqIpacm0ERVbEOPIQ= Original-Received: from SA2PR10MB4474.namprd10.prod.outlook.com (2603:10b6:806:11b::15) by SA2PR10MB4457.namprd10.prod.outlook.com (2603:10b6:806:115::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 22:02:53 +0000 Original-Received: from SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::b8d2:db6d:3e4b:d315]) by SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::b8d2:db6d:3e4b:d315%5]) with mapi id 15.20.3846.043; Wed, 17 Feb 2021 22:02:53 +0000 Thread-Topic: [External] : Re: Sorting command completions by recency Thread-Index: AQHXBWmGzoAuR/SFUEO0z2sHGN8CKapc3S8g In-Reply-To: <87o8gifoci.fsf@mail.linkov.net> Accept-Language: en-US Content-Language: en-US authentication-results: linkov.net; dkim=none (message not signed) header.d=none;linkov.net; dmarc=none action=none header.from=oracle.com; x-originating-ip: [73.170.83.28] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e6d25e1a-66ce-4557-3a21-08d8d38fc652 x-ms-traffictypediagnostic: SA2PR10MB4457: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: T3SPyYGrsFNsaEVQBET1zgkWBZcOXuc9uYZ/Jti5rAPPeuRbSeXj4LJkDbYV6LYiZP0f9gphrb0WRiVL7c44Modcs7p/6fJhkA4K9IV7pFoGjtbg4HV/YbsjgAs7tTXf3wxwH0R2UmQQFgGefTcEkycHE+UxUAM01/Kx1nCNClAUUnmViFRL3xWfqZ+TY9Te7iULk9LQUuzMXXIhVjhrDf42qG+1sczHZSItXfQihd5bDAo5rhkCwYuyVk8zWfsj7+FFMJDxfuMmPLZXjG7gwVbMCBx/6ax42ShHodHjlBG9/55HrY1baIAJnmSifZm4pLr2mOcNizzmFed9hw5c+UC5zTJBwEBzImPyr2Cd4GeoKA5rAAPFR5VnFs/HhqF+ZJ5LlGskJTnl/+l91zrsOEU4kTCcC1fDpnbkWoYJF5l7M6gvQSfGXdqH9nsZJwKoMU4TMcpxtuWsU4Ub7xDOGr3VbsGKkgPnWsZvolZwUNXfh4ysipC8+wiitluWUMbfmw5zEST7PW2Tr3woHq3zFTn4IybvW8VPth+lj0MBZ9J2kjZvwGDJWjhYxnmY4pC/yVYOWfxdQCFmAoUm3PZIv76bFXXeSJK1KxG3oOkm30g= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4474.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(39860400002)(366004)(346002)(136003)(396003)(44832011)(8676002)(64756008)(52536014)(966005)(71200400001)(76116006)(5660300002)(186003)(66946007)(26005)(6506007)(2906002)(66476007)(83380400001)(66556008)(8936002)(66446008)(478600001)(9686003)(316002)(7696005)(33656002)(55016002)(86362001)(54906003)(4326008)(110136005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?xCWxok+KXbaxFtObiKr26HNMcSklXUGDRLaUlV3mEx6R4sOZfdPE0leA0XWq?= =?us-ascii?Q?tAO5iFiZyMhvJaJ202OKNKLFOuOPGa2unrhsgUqAAtVCZq2SUzoB+GPWNNPh?= =?us-ascii?Q?PuuwOHNh+rqZqY5y6pQhrimxqZXJranqOEm4VZJyw1ne4fS8hdUgDFO33wMQ?= =?us-ascii?Q?2c0v6XzlCqDqGGh6cRPQOa8IFfaJgYm1NZHiZ23zYNWwWrXp8taDurgsJ3N7?= =?us-ascii?Q?5O7AVyZr4y79wI/OS0i4CdDH1zkYJy2JU8KOI4Vrb8R/aFtgrUmoJuUmN2Ri?= =?us-ascii?Q?pmjFVRVQF5GrSzZDoLyy7t6IB+8QaQcCoZ0n0H1vG2GKV/6N2Kt9HYx20WL0?= =?us-ascii?Q?PmXG/WIrwSJsi4CqMg/DrGnkKJLM40gjhl4oxt7Aw+O/lk8qMr7WekfhRNCU?= =?us-ascii?Q?rxK1g8PgQI5PRBxSSku0C2071mDC/Pd6zqJoplmdk+Philp43VQ8qrU1j9el?= =?us-ascii?Q?Dxg8Ol+vT9xADXfs+RgDF5oaSWhj0ABuT9JrzcmLnqpyxMuO7+wwSb7yP6Vm?= =?us-ascii?Q?Hjtaglm53f6IOz39pMyS8Ob1CeaHAIj1SoIXvl3sQ6vHJzpBl8NmsTUzGWVD?= =?us-ascii?Q?VhsFS5/ZBGgK2zyfiIBB2D6WjJiy301pApg75pmzROoJWX6eumUKHWhFvVA7?= =?us-ascii?Q?OILg x-ms-exchange-transport-forked: True X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4474.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6d25e1a-66ce-4557-3a21-08d8d38fc652 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Feb 2021 22:02:53.3489 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7HTmevLA+t1J3mspOz8N+AJSzlW6GXWcxE2fle957I1yBD7Kj4vRtHdbBmzl3+aO31t5ulyPFyfTDQeU2UMrxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4457 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170162 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170162 Received-SPF: pass client-ip=141.146.126.79; envelope-from=drew.adams@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265092 Archived-At: > Maybe a new option should allow switching the sorting order. > Perhaps, it should have a form of an alist: >=20 > '(("alphabetical" . identity) > ("by recency" . >? (lambda (commands) > (if (minibufferp) > (let ((hist > (symbol-value > minibuffer-history-variable))) > (sort commands ... FWIW, Icicles has such an option (but it also lets you change the option value during completion, by hitting a key). Commands can bind it to get relevant sort orders. For example, this is its let-binding for command `icicle-complete-keys': (icicle-sort-orders-alist '(("by key name, local bindings first" . icicle-local-keys-first-p) ("by key name, prefix keys first" . icicle-prefix-keys-first-p) ("by command name" . icicle-command-names-alphabetic-p) ("turned OFF"))) ,---- | icicle-sort-orders-alist is a variable defined in `icicles-opt.el'. | Its value is nil. |=20 | Documentation: | Alist of available sort functions. | This is a pseudo option - you probably do NOT want to customize this. | Instead, use macro `icicle-define-sort-command' to define a new sort | function and automatically add it to this list. |=20 | Each alist element has the form (SORT-ORDER . COMPARER): |=20 | SORT-ORDER is a short string or symbol describing the sort order. | Examples: "by date", "alphabetically", "directories first". |=20 | COMPARER compares two items. It must be acceptable as a value of | `icicle-sort-comparer'. |=20 | You can customize this variable. `---- COMPARER here can be a simple predicate; a list of special predicates, which return (t) for true, (nil) for false, or nil for undecided; or such a list followed by a simple predicate. You can easily combine multiple predicates in a manner similar to running through hook functions with `run-hook-with-args-until-(failure|success)', i.e. until one of the predicates decides: https://www.emacswiki.org/emacs/ApplesAndOranges (Bookmark+ makes more use of such predicate combinations. It uses the same idea.) =20 Macro `define-sort-command' defines a command to switch to a given sort order during completion (or any other time). Sorting, together with filtering and progressive completion (aka narrowing), can greatly improve usability. Cycling without being able to sort in a useful way can amount to drudgery. https://www.emacswiki.org/emacs/Icicles_-_Sorting_Candidates HTH.