From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last Date: Sun, 01 Jan 2023 13:42:50 -0500 Message-ID: References: <87358u5y6l.fsf@daniel-mendler.de> <226b32f79f2d431d75b6@heytings.org> <009141ba-c21a-a5cb-a81b-c72a12a26207@daniel-mendler.de> <226b32f79f728e6bfed4@heytings.org> <82cf05e4-3c3f-9804-4801-eb31988f6d7d@daniel-mendler.de> <226b32f79f325daf9c7a@heytings.org> <226b32f79fe1e154cfb4@heytings.org> <226b32f79f056489e881@heytings.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2281"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Daniel Mendler , Eli Zaretskii , 60464@debbugs.gnu.org, Jim Porter To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 19:43:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pC3Ik-0000PI-1Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 19:43:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pC3IW-0002av-DI; Sun, 01 Jan 2023 13:43:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pC3IU-0002aO-Gq for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 13:43:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pC3IU-0003XC-8w for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 13:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pC3IU-00061Q-4j for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 13:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2023 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60464 X-GNU-PR-Package: emacs Original-Received: via spool by 60464-submit@debbugs.gnu.org id=B60464.167259858023140 (code B ref 60464); Sun, 01 Jan 2023 18:43:02 +0000 Original-Received: (at 60464) by debbugs.gnu.org; 1 Jan 2023 18:43:00 +0000 Original-Received: from localhost ([127.0.0.1]:41760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC3IS-00061A-3a for submit@debbugs.gnu.org; Sun, 01 Jan 2023 13:43:00 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pC3IQ-00060x-DN for 60464@debbugs.gnu.org; Sun, 01 Jan 2023 13:42:58 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0CCE5805D5; Sun, 1 Jan 2023 13:42:53 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 79219800AE; Sun, 1 Jan 2023 13:42:51 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1672598571; bh=gbsFK3VuN83aQetqIefbHtHKQMyD22I3GRtGYs558R4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=daP+lSDR+N2BF5nv5eCeDaPlmFRzo1cbjlFv/JDJT+Tfh+rwAcUDLRhniJFBxu/rm CkGMP96YzyFzYzM9pm8vg0KlMmmb45t/tuLkfgvkGjEIG/1/knsFOdSQPINPEujF/J P1/E7hGiwREhONil0O3jqRessu+2Hf+XCqC8iRn8UZ66wKVubmUXok/oKhjyJjpAto TIblJ5VGa2beKWrEpJNdJfjqt8OXJ4OHGx/00tpDefy35Ogzw444+CCtXlfV65xUwY D8cc3woBZJWfp3b23cF76/MNDHT0SU6voYfnFlFZNchHf1qQKzRgp38j+XTYQVSl9T yrWHcDJ1EKqIg== Original-Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 28A7712017F; Sun, 1 Jan 2023 13:42:51 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Sun, 01 Jan 2023 13:38:28 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252276 Archived-At: > For the first, would the patch below help? Well, obviously not because I didn't bother to look at the rest of the code. Maybe this one would be closer, tho it probably needs some handling for the boundary case where `index` is the last. Stefan diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 2d3730e294a..36968d3b73c 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -1,6 +1,6 @@ ;;; pcomplete.el --- programmable completion -*- lexical-binding: t -*- -;; Copyright (C) 1999-2022 Free Software Foundation, Inc. +;; Copyright (C) 1999-2023 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Keywords: processes abbrev @@ -652,18 +652,17 @@ pcomplete-arg representation of the argument, namely what the user actually typed in, is returned, and the value of the argument is stored in the pcomplete-arg-value text property of that string." - (let ((arg - (nth (+ (pcase index + (let* ((index (+ (pcase index ('first 0) ('last pcomplete-last) (_ (- pcomplete-index (or index 0)))) - (or offset 0)) - pcomplete-args))) + (or offset 0))) + (arg (nth index pcomplete-args))) (if (stringp arg) arg (propertize - (buffer-substring (pcomplete-begin index offset) - (pcomplete-begin (1- (or index 0)) offset)) + (buffer-substring (nth index pcomplete-begins) + (nth (1+ index) pcomplete-begins)) 'pcomplete-arg-value arg)))) (defun pcomplete-begin (&optional index offset)