GNU bug report logs - #72210
31.0.50; Feature request: multi-category support in `icomplete-fido-kill'.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Fernando de Morais <fernandodemorais.jf@HIDDEN>; dated Sat, 20 Jul 2024 14:26:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 4 Apr 2025 19:16:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 04 15:16:56 2025
Received: from localhost ([127.0.0.1]:39968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u0mX9-0007BK-Sw
	for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:16:56 -0400
Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:49263)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <fernandodemorais.jf@HIDDEN>)
 id 1u0mX6-0007Az-OD
 for 72210 <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:16:53 -0400
Received: by mail-pl1-x629.google.com with SMTP id
 d9443c01a7336-22622ddcc35so32025715ad.2
 for <72210 <at> debbugs.gnu.org>; Fri, 04 Apr 2025 12:16:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1743794206; x=1744399006; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:references
 :message-id:date:in-reply-to:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=0kxbo1ZmT2feFpPCEkYdAgjLRZTwe1DmSqZbkiuGT8k=;
 b=UayheuQRUgZo0SiRr++c3cXVOEPI/+24LLc42qc6NMGhEWgRuf1FCdHNEpWUCGIhsu
 +J2v98SqCmuD0Ko4QYfQRjHpEOgiQLNeKgYRjifeyn/Obl5JuwfMJmMC80np446wS9uk
 OrHdhJ6Sf/pk2qN3s1OE9LjMEg82TUZGObWWSbfuoIMGqY4hK3c+OkHxn+uhFL5bTK5Q
 MUJzqaD8eRvVEbKVsIYjxtUebA34/3rQ8TPoF/JH7ci/mqy9KHVu6LcbcuLE4OrmTTjw
 cGbh3HgfbIUiTEng5J5vdjjUMuKwD35KotIW5SKksA0tU6MkKoKMSyrD3vdelgknuPcr
 JqjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1743794206; x=1744399006;
 h=content-transfer-encoding:mime-version:user-agent:references
 :message-id:date:in-reply-to:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=0kxbo1ZmT2feFpPCEkYdAgjLRZTwe1DmSqZbkiuGT8k=;
 b=s/s5/0LBg8lhBNba5ABvyu2kzUTTWb1iJwfD21LD/W9lpVuIDJ9kCvi/Cyv96PiumL
 m3+vYyTkpGT9EVylpPWQrG465o6FpCG2LisnHupcN6vw+jaOiV+r4MF9ZYIdwh+pLTix
 VDFltcQNM9K86eYWmsIhqO2qUtOWABgilnbEqEH2Bl04M69FlV2lgDrGpMTT/E6xGRz+
 XylXpq4qQyZv+b5Xjuhnu11kUDRLUzvKU9N1m7AYpBZSsr2kmffMBiuqPICvU5dUtExu
 mGfvwVddtiixor4lVTJEcIEVYB36vwbDFOSYcYJWqrSXPTkbRSuc+X2HIQvdqbLGfNZJ
 ooYA==
X-Gm-Message-State: AOJu0YwLsXffppv4sO6p6Ghlmzui8kdEwsRwxNOC6JxcC+BkMcu4XQ9y
 BYuxRRR3uaHjcklBPvUf6yteoykZGg4tvuVL9xg2lPTIEYVXv8KC
X-Gm-Gg: ASbGnctvSqRfYvfuDmCThLQ66ZFM+SvBCjL0HTRte77RCKPEdeo/f/PW8Z3jYeslNnN
 0+tBqCX/rqi55nBbl+GXC+9L8nPfLmeSXeNQi23vAsfzVi6x3m+Ar/6cV6mK6pq32ALxDPfQ7ls
 DVZoQW9PQQe+Pq342JH5KTHbz0pfVpCy7P/0QNMkfBAH5N7qZwA4l1zNt3Ip9y0LUAYz0QV8ta3
 ECRyjmMVwYWZmK9GLds9vLlebfJPmwM/hSPRwUBb8u0oupYjHP6rFcFJBga4LPoX/e7UQdNm/zR
 FAS4nn8SVS1S8LISqfrUftFO+KX760FrXcUk2TANazYM
X-Google-Smtp-Source: AGHT+IEa1FTlQUAEk+EzdGtKXmq3gw2yw3ss6lj/yuRwaHOXZB3RKijOFtYmb5J1+MwjrRjwaJMImw==
X-Received: by 2002:a17:902:fc50:b0:223:6455:8752 with SMTP id
 d9443c01a7336-22a95586abbmr8346145ad.43.1743794206244; 
 Fri, 04 Apr 2025 12:16:46 -0700 (PDT)
Received: from sekai ([2804:14c:da80:913c::b344])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-229785c0d15sm36354385ad.93.2025.04.04.12.16.44
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Apr 2025 12:16:45 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <jwv8quqg7w9.fsf-monnier+emacs@HIDDEN>
Date: Fri, 04 Apr 2025 16:16:11 -0300
Message-ID: <874iz3d9fo.fsf@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN> <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
 <87r09fr4zt.fsf@HIDDEN> <jwvfrppj68r.fsf-monnier+emacs@HIDDEN>
 <87seszzbst.fsf@HIDDEN> <jwv8quqg7w9.fsf-monnier+emacs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Just a quick testimony regarding the last code suggested:

I=E2=80=99ve been using `icomplete' patched with your code, Stefan, since t=
hen
and it has been working perfectly!

Do you think the patch you suggested could be installed?  Or should the
confirmation-prompt issue be resolved first?

Thanks!

--=20
Regards,
Fernando de Morais.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 14 Oct 2024 13:00:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 14 09:00:06 2024
Received: from localhost ([127.0.0.1]:37174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0Kg9-0000wb-Ka
	for submit <at> debbugs.gnu.org; Mon, 14 Oct 2024 09:00:05 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7125)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1t0Kg7-0000vZ-Bh
 for 72210 <at> debbugs.gnu.org; Mon, 14 Oct 2024 09:00:04 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 09EC94425D1;
 Mon, 14 Oct 2024 08:59:40 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1728910779;
 bh=D8y2tkag63UTZLOJEQ4Dc4Y2DKqaN8Fqx/nmUOx4nfc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=e8VU71Mj8Cb36ZwOU6vB74G6rrtuVkkRH5mmOsP/OH69o2FYa6844GrqSGaHnXiAo
 I3GFjq9AcjuSlC4apfVu3uPYfdOZgd26dTh+0KQHfon4pypSNVQB6ZF9BjVTw7R2Xn
 PEtWblm4ezqCWBunEeZI3fCeN84R8Ojl1AX0SqDuscvebTlyVmyHoZlz7Fu6P0B19/
 Ek92EtGPhiRByQAtFyl2PGmxraz747QVZY4oT7E4L2TqxTo5XLIKD12kFI22Xu6mZj
 lGyZ1tXlGXrMLRl+tVqKY/Ua88PqHGjohnzg2YODHeKzvgcNfrWVZIJklX0vTQGFVB
 v7XJkbmKAw7Ng==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EBC364425A1;
 Mon, 14 Oct 2024 08:59:38 -0400 (EDT)
Received: from pastel (104-195-209-82.cpe.teksavvy.com [104.195.209.82])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BC77E1204CE;
 Mon, 14 Oct 2024 08:59:38 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <87seszzbst.fsf@HIDDEN> (Fernando de Morais's message of "Sun, 
 13 Oct 2024 22:57:22 -0300")
Message-ID: <jwv8quqg7w9.fsf-monnier+emacs@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN> <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
 <87r09fr4zt.fsf@HIDDEN> <jwvfrppj68r.fsf-monnier+emacs@HIDDEN>
 <87seszzbst.fsf@HIDDEN>
Date: Mon, 14 Oct 2024 08:59:37 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.038 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> I wasn't sure if you were waiting for a response from Daniel or another
> user of `icomplete', but from my side,

Was kind of hoping for some help from someone, or just for my brain to
come up with a solution to the confirmation-prompt problem.

> I liked the idea of using `cl-defgeneric'!

=F0=9F=99=82

> However, I couldn't use the implementation from the last patch.
> When I try to load the patched `icomplete', I receive this error:
>
>         Unknown specializer (eq 'buffer)

That was a typo, it should say `eql` rather than `eq`, sorry 'bout that.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 14 Oct 2024 02:00:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 13 22:00:25 2024
Received: from localhost ([127.0.0.1]:33706 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0ANl-000799-1K
	for submit <at> debbugs.gnu.org; Sun, 13 Oct 2024 22:00:25 -0400
Received: from mail-pf1-f173.google.com ([209.85.210.173]:52383)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fernandodemorais.jf@HIDDEN>) id 1t0ANh-00078k-KX
 for 72210 <at> debbugs.gnu.org; Sun, 13 Oct 2024 22:00:23 -0400
Received: by mail-pf1-f173.google.com with SMTP id
 d2e1a72fcca58-71e5130832aso737010b3a.0
 for <72210 <at> debbugs.gnu.org>; Sun, 13 Oct 2024 19:00:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1728871139; x=1729475939; darn=debbugs.gnu.org;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=U+vaPofmcZWVHmJ2y24HUDAPZn1rCEcxSgG8To/NmPk=;
 b=MVn7F/8zNiSlQlQ86I4A8VxUZig3n9t84mvZExzqciwF2LH1s4WK/7xEeFT0BQfikD
 RsfUuclElJ/zCpevXmo67Iktu3tr+p5Cgbn4FCSDlwzBZ+R8XAq06f+L9zh/aCgN+sQI
 V3W51LE20Gxj7iEzY0L2TU23UmKICYx8p2iXQNLFiFEv/uj4YFDkky3XYhrBNJxCtW45
 3SzfXFCDDtIGjvi6fA8hlGIYBXLeEfl6PowedVjMx98fTEMDBJqU3WdZeGvI+dF1WWiM
 j7bcSCGjLX9DTbFOIFJ4bUH5k+4gUoZq58+73G3bQeDEG6JRuZ1AA7bnHEGA78+S+4Xn
 WFeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728871139; x=1729475939;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=U+vaPofmcZWVHmJ2y24HUDAPZn1rCEcxSgG8To/NmPk=;
 b=GOHkK6VuIzZKt1ztnKTsWTksXhEptYNth4xpYhZ1uCdnfyTyHitKgbJ9TISSRSzpRc
 QKRLgfMQFwUeOLu8XUHM0gfV2GelU4gIs86SJud7suSwWTM64/ssKM93fNSSIgrMAFQ/
 K3xrXmPqVD4Kuc4dnRHVip1Hxfz6Rjh0JR/xJfDVvPLZh1CEh+UOZt5jB/W6+SLkwLKW
 eR5Kzp3JjMkFvfsO6FzFo/3k9qrsN7w+vDMHnFljcl4HiS+JG5/A7dwE+2ITcV7WARUr
 KICQAHRHOgy2oaZ5MaSbhrjFYAP/X6IEepqLRSjyMcLse6Fw+SqgGnu+TGM+0xEXLp33
 k8pQ==
X-Gm-Message-State: AOJu0YxwGHHvVMtpiZYyVoakRiv4bBzwTbcUX6tXHYWUld+EIwS7C07v
 K60hjC8NONs0Tl+QjN4blwrhKgGGIElPYLV5jbBxonVpl+n56kF4
X-Google-Smtp-Source: AGHT+IE+QnuyGe/HiBZB03r60cbqLgwpiME1ihJ3+NXvATHtylNg/H8TvxH4RxKxH9HcnRo8KgoH1A==
X-Received: by 2002:a05:6a20:c797:b0:1d3:5208:1ea6 with SMTP id
 adf61e73a8af0-1d8c96ba5femr10128175637.45.1728871139026; 
 Sun, 13 Oct 2024 18:58:59 -0700 (PDT)
Received: from sekai ([2804:14c:da80:83fa::3a8e])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71e582700bbsm2456535b3a.164.2024.10.13.18.58.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 13 Oct 2024 18:58:58 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <jwvfrppj68r.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 24 Sep 2024 13:50:31 -0400")
Date: Sun, 13 Oct 2024 22:57:22 -0300
Message-ID: <87seszzbst.fsf@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN> <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
 <87r09fr4zt.fsf@HIDDEN> <jwvfrppj68r.fsf-monnier+emacs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Stefan,

Stefan Monnier <monnier@HIDDEN> writes:

>> This is indeed a better idea!  I'm not very familiar with `cl-*' code,
>> but the way you suggest makes `icomplete-fido-kill' very flexible.  As I
>> understand it, even if `consult' doesn't define its methods, we can
>> still do it ourselves as end users, without needing to advise or
>> override the original function.
>
> Indeed, tho it would rely on "internal knowledge" of consult's
> `multi-category`.
>
> I'm not 100% happy with my suggestion, tho.  One of the problems is the
> name (should it include "fido"?   Currently, `icomplete-fido-kill` and
> `icomplete-fido-ret` can misbehave in non-fido-mode, because of an
> assumption they make about the completion-style).  The other is the
> confirmation prompt, which feels like it should be implemented once and
> for all outside of the generic function.
>
> For reference here's my current code.

I wasn't sure if you were waiting for a response from Daniel or another
user of `icomplete', but from my side, I liked the idea of using
`cl-defgeneric'!

However, I couldn't use the implementation from the last patch.  When I
try to load the patched `icomplete', I receive this error:

        Unknown specializer (eq 'buffer)

Thank you for looking into this issue!

-- 
Regards,
Fernando de Morais.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 24 Sep 2024 17:51:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 24 13:51:09 2024
Received: from localhost ([127.0.0.1]:60306 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1st9gq-0003NE-HE
	for submit <at> debbugs.gnu.org; Tue, 24 Sep 2024 13:51:08 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64150)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1st9go-0003Mg-9S
 for 72210 <at> debbugs.gnu.org; Tue, 24 Sep 2024 13:51:07 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 482F9100042;
 Tue, 24 Sep 2024 13:50:33 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1727200232;
 bh=/eKJg6eF3Izn8Nokm36nCqJzZvxNZf6r0XVevx3IXqQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=fnHMIjp/o46Yd41dO2POWDAz2Kn0iV4TvFtd3u0NMZxS48sOWBASVgciY0UDRUHIv
 zG84fQTF7M1l7wGASDcBoD2V66+Ycu8+VdbKGHa+yZmH3Erzd8jaC+PkPRUlujb389
 T2KxO97WRBbxKobVnU9xRpV3UraUt8GF2unPJH3Rv+21axPXPl1iP2RLe81pV/FBsY
 36nx2zdJh3N21BnoSlt12TdaZT6L8qkBJMFrlpJhIlyIUDQkR0zDyu+nceV2dCIy8k
 jNczcP5yhUMcW6V8uDb4f++noYMOoArCmV/uT+03N5YMXh/jDl70aVKEg7ULcWnwkk
 m9iekaCgZa9oQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 71D0510005D;
 Tue, 24 Sep 2024 13:50:32 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 60A051207E8;
 Tue, 24 Sep 2024 13:50:32 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <87r09fr4zt.fsf@HIDDEN> (Fernando de Morais's message of "Thu, 
 19 Sep 2024 13:19:02 -0300")
Message-ID: <jwvfrppj68r.fsf-monnier+emacs@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN> <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
 <87r09fr4zt.fsf@HIDDEN>
Date: Tue, 24 Sep 2024 13:50:31 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.161 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

>> Maybe a better option would be something like the patch below,
>> so `consult` could define its own method for its own category, which
>> could even extend the semantics to do thing like delete bookmarks when
>> applied to bookmarks, etc...
>
> This is indeed a better idea!  I'm not very familiar with `cl-*' code,
> but the way you suggest makes `icomplete-fido-kill' very flexible.  As I
> understand it, even if `consult' doesn't define its methods, we can
> still do it ourselves as end users, without needing to advise or
> override the original function.

Indeed, tho it would rely on "internal knowledge" of consult's
`multi-category`.

I'm not 100% happy with my suggestion, tho.  One of the problems is the
name (should it include "fido"?   Currently, `icomplete-fido-kill` and
`icomplete-fido-ret` can misbehave in non-fido-mode, because of an
assumption they make about the completion-style).  The other is the
confirmation prompt, which feels like it should be implemented once and
for all outside of the generic function.

For reference here's my current code.


        Stefan

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=icomplete.patch

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2ea5e36fa88..c37275587b6 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -317,6 +317,30 @@ icomplete-vertical-goto-last
 
 ;;;_* Helpers for `fido-mode' (or `ido-mode' emulation)
 
+(cl-defgeneric icomplete-kill-candidate (category _candidate)
+  "\"Kill\" CANDIDATE, assuming it is of kind CATEGORY.
+CANDIDATE is a string denoting a completion candidate,
+CATEGORY should be a completion category, as specified
+in `completion-metadata'.
+\"Kill\" here means to actually delete the underlying object, such
+as a file, buffer, ..."
+  (error "Don't know how to kill things for category `%s'" category))
+
+(cl-defmethod icomplete-kill-candidate ((_ (eq 'buffer)) thing)
+  ;; FIXME: Shouldn't the confirmation prompting be done by the caller?
+  (when (yes-or-no-p (concat "Kill buffer " thing "? "))
+    (kill-buffer thing)))
+
+(cl-defmethod icomplete-kill-candidate ((_ (eq 'file)) thing)
+  ;; FIXME: This makes assumptions about completion style: e.g. with
+  ;; partial-completion, `/usr/s/d/ema' can result in DIR being
+  ;; `/usr/s/d/' and THING being `share/doc/emacs', in which case DIR
+  ;; isn't the right base directory to pass to `expand-file-name'!
+  (let* ((dir (file-name-directory (icomplete--field-string)))
+         (file (expand-file-name thing dir)))
+    (when (yes-or-no-p (concat "Delete file " file "? "))
+      (delete-file file) t)))
+
 (defun icomplete-fido-kill ()
   "Kill line or current completion, like `ido-mode'.
 If killing to the end of line make sense, call `kill-line',
@@ -331,26 +355,12 @@ icomplete-fido-kill
         (call-interactively 'kill-line)
       (let* ((all (completion-all-sorted-completions))
              (thing (car all))
-             (cat (icomplete--category))
-             (action
-              (cl-case cat
-                (buffer
-                 (lambda ()
-                   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
-                     (kill-buffer thing))))
-                ((project-file file)
-                 (lambda ()
-                   (let* ((dir (file-name-directory (icomplete--field-string)))
-                          (path (expand-file-name thing dir)))
-                     (when (yes-or-no-p (concat "Delete file " path "? "))
-                       (delete-file path) t))))
-                (t
-                 (error "Sorry, don't know how to kill things for `%s'" cat)))))
+             (cat (icomplete--category)))
         (when (let (;; Allow `yes-or-no-p' to work and don't let it
                     ;; `icomplete-exhibit' anything.
                     (enable-recursive-minibuffers t)
                     (icomplete-mode nil))
-                (funcall action))
+                (icomplete-kill-candidate cat thing))
           (completion--cache-all-sorted-completions
            (icomplete--field-beg)
            (icomplete--field-end)
@@ -373,6 +383,8 @@ icomplete-fido-ret
                    (file-name-directory (icomplete--field-string))))
          (current (car completion-all-sorted-completions))
          (probe (and dir current
+                     ;; FIXME: Same problem as in
+                     ;; `icomplete-kill-candidate<file>' above.
                      (expand-file-name (directory-file-name current)
                                        (substitute-env-vars dir)))))
     (cond ((and probe (file-directory-p probe) (not (string= current "./")))

--=-=-=--





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 19 Sep 2024 16:21:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 12:21:34 2024
Received: from localhost ([127.0.0.1]:33380 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srJuQ-0000Vn-2q
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 12:21:34 -0400
Received: from mail-pg1-f174.google.com ([209.85.215.174]:61587)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fernandodemorais.jf@HIDDEN>) id 1srJuN-0000VU-NE
 for 72210 <at> debbugs.gnu.org; Thu, 19 Sep 2024 12:21:32 -0400
Received: by mail-pg1-f174.google.com with SMTP id
 41be03b00d2f7-7d4fa972cbeso767507a12.2
 for <72210 <at> debbugs.gnu.org>; Thu, 19 Sep 2024 09:21:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726762808; x=1727367608; darn=debbugs.gnu.org;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=VLzeQskmZxVGCZQDur3uJWoWligea3td4xchzWXeAmI=;
 b=dflZa22+yjZBUkEMFQnB9TstNl3zBtdtdFtmMlhbKVGYXKQIkRSwEjrCCj91zdXtyS
 /MTU04qBKlS8UM84ch7KbzytxeaJOlXtzOPgLYAPOY5mSosg4mZgPpjrpqj1CIXa0QoJ
 iR4RaVqzW+34ZJX72K4Zi+7DegE4U0CRf6BrnlpEMnpyvOBWwpCeAZfM4Qw3/9haKmOl
 GaqsamRmf0+cB2sAH6lhnXC/GY2lORPk9xcJRkiWDxnLqwmH9V+H7PjV+J5G+Klqe25W
 T7vlPRkQtLBn9I1glA+Ekl3H+s87+iI6WFgvITukWhOgHhmY7L42/GskzWTN0THjurKN
 NAIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726762808; x=1727367608;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=VLzeQskmZxVGCZQDur3uJWoWligea3td4xchzWXeAmI=;
 b=N7bb5RHwKiOdWyQzSa2zFArxHNEWn6eUsOcNfSc2Y5mPHPqmajOj7BmtlWJsEJu4Pr
 6yiEEb4aCAMLKM9mCaRYeurHprv68Eh1GVp7alHEknU+EhEQ+wpuue6QH5lebm3+HA12
 5RFhuhF+owWqNVKpbWivkG1LGAVlMMTX5soocQkdvdV9HCLEjcOe1wNClvLTmJVvWxOm
 55k5edn2JFjhbekXRM1+KMb9nZmoWStEi+08JnroZwC0g0+jYuGQIQ36OzTlFt7/5p4z
 hC6qKvo0flLqbPFRsFh9Raj94Yyc1paFWYplKFGKFXDBDsvgv9RKwPgjtGN2VppDPqud
 6Rgg==
X-Gm-Message-State: AOJu0YzQd85jFyYPYeGWiu3+9yDQ5RgJiQ3wmZp9taDNhE/kwcPr6/kr
 cc1G0Moxg/YGvD/WPCiYV9FMIHzBe/LQ8zMNIPoVPuvvNBB1dWTH
X-Google-Smtp-Source: AGHT+IEk0XI6wHQTuEYevA092ujYosEcCdkTEIEZmP9X86ji3fuEZgiWDS+yn08uJbxwvMbhqUfkwg==
X-Received: by 2002:a17:903:944:b0:206:998d:6ea0 with SMTP id
 d9443c01a7336-2076e39bf6fmr382989755ad.33.1726762807778; 
 Thu, 19 Sep 2024 09:20:07 -0700 (PDT)
Received: from sekai ([2804:14c:da80:83fa::f810])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-2079473f7a7sm81697275ad.291.2024.09.19.09.20.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 19 Sep 2024 09:20:07 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 17 Sep 2024 17:15:18 -0400")
Date: Thu, 19 Sep 2024 13:19:02 -0300
Message-ID: <87r09fr4zt.fsf@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN> <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Stefan,

Stefan Monnier <monnier@HIDDEN> writes:

> Maybe a better option would be something like the patch below,
> so `consult` could define its own method for its own category, which
> could even extend the semantics to do thing like delete bookmarks when
> applied to bookmarks, etc...

This is indeed a better idea!  I'm not very familiar with `cl-*' code,
but the way you suggest makes `icomplete-fido-kill' very flexible.  As I
understand it, even if `consult' doesn't define its methods, we can
still do it ourselves as end users, without needing to advise or
override the original function.

Thanks!

-- 
Regards,
Fernando de Morais.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 17 Sep 2024 21:15:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 17 17:15:46 2024
Received: from localhost ([127.0.0.1]:56135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqfY2-0005zN-DX
	for submit <at> debbugs.gnu.org; Tue, 17 Sep 2024 17:15:46 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8489)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1sqfY0-0005z7-9O
 for 72210 <at> debbugs.gnu.org; Tue, 17 Sep 2024 17:15:45 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 19BA5441418;
 Tue, 17 Sep 2024 17:15:22 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1726607719;
 bh=gpKOQae0B0lZkUHpHmBCFHiICA4/axtJialkYvcij5Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=KjCz7N/zoiTV9eY2mLy3voc1DNYAQLDRwipvZ2al2/nWuf/JZ7qz7lFd4cP0zuAws
 ltt0KtacR0BUYphlddJdCbzypaN2TbauchhDL6g9lAyhd+XWhNfEUk69Dr2UEf6/H+
 fYM6SmDJtLg4+ZTSf6f6gR74m677Xdp7Mp0tDQvafQ+60eHdOJ36Bxh5Bdh6U+c6dP
 /wu9TUoN0U1/DAbszGHzN6iDTOOY1sKNrgbage+2Bqdk+FaADZwLTWrDhxONibk7sz
 P2oENohg6luXbGSyklBWm+RDACjeTxg9JLRG9HGyJWkFFvcKxixMOODj/N6/wjjWx3
 KglKo1zGYISrA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 99675441364;
 Tue, 17 Sep 2024 17:15:19 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 84AD81204FB;
 Tue, 17 Sep 2024 17:15:19 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'
In-Reply-To: <87r0a258js.fsf@HIDDEN> (Fernando de Morais's message of "Mon, 
 02 Sep 2024 13:23:19 -0300")
Message-ID: <jwvo74mgjz6.fsf-monnier+emacs@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN>
Date: Tue, 17 Sep 2024 17:15:18 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.165 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: Daniel Mendler <mail@HIDDEN>, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

> #+begin_src emacs-lisp
> (progn
>   (package-initialize)
>   (load-library "consult")
>   (icomplete-vertical-mode t)
>   (keymap-set icomplete-minibuffer-map "C-k" 'icomplete-fido-kill))
> #+end_src
>
> - Then, ``M-x consult-buffer'';
> - Type *M (this should turn the `*Messages*' buffer the current
>   candidate);
> - Then ``C-k''
>
> The following message should appear in the minibuffer:
>
> [Sorry, don=E2=80=99t know how to kill things for =E2=80=98multi-category=
=E2=80=99]

Oh, I see, so the issue is that `consult-buffer` lists not just actual
buffers but also recently visited files and other sources, so it
specifies as `category` the symbol `multi-category` and then it uses
some internal convention about how each completion candidate is
annotated with its type.

> Follows attached!  This is my first patch, so I might have made
> mistakes, but I'm here to adjust whatever you deem necessary.

And your patch adds support to `icomplete.el` for this
specific convention.

There are a few too many things that are "ad-hoc" in that approach for
my taste, but I agree that there's a good justification for adding
support for completion tables that can use a mix of different types and
thus need to offer some way to know further details about the category
of any given completion candidate.

Maybe a better option would be something like the patch below,
so `consult` could define its own method for its own category, which
could even extend the semantics to do thing like delete bookmarks when
applied to bookmarks, etc...


        Stefan

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=icomplete.patch

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2ea5e36fa88..8013f68dcf4 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -317,6 +317,20 @@ icomplete-vertical-goto-last
 
 ;;;_* Helpers for `fido-mode' (or `ido-mode' emulation)
 
+(cl-defgeneric icomplete-fkill-candidate (category _candidate)
+  (error "Sorry, don't know how to kill things for `%s'" category))
+
+(cl-defmethod icomplete-kill-candidate ((_ (eq 'buffer)) thing)
+  (when (yes-or-no-p (concat "Kill buffer " thing "? "))
+    (kill-buffer thing)))
+
+(cl-defmethod icomplete-kill-candidate ((_ (eq 'file)) thing)
+  (let* ((dir (file-name-directory (icomplete--field-string)))
+         (file (expand-file-name thing dir)))
+    (when (yes-or-no-p (concat "Delete file " file "? "))
+      (delete-file file) t))))
+
+
 (defun icomplete-fido-kill ()
   "Kill line or current completion, like `ido-mode'.
 If killing to the end of line make sense, call `kill-line',
@@ -331,26 +345,12 @@ icomplete-fido-kill
         (call-interactively 'kill-line)
       (let* ((all (completion-all-sorted-completions))
              (thing (car all))
-             (cat (icomplete--category))
-             (action
-              (cl-case cat
-                (buffer
-                 (lambda ()
-                   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
-                     (kill-buffer thing))))
-                ((project-file file)
-                 (lambda ()
-                   (let* ((dir (file-name-directory (icomplete--field-string)))
-                          (path (expand-file-name thing dir)))
-                     (when (yes-or-no-p (concat "Delete file " path "? "))
-                       (delete-file path) t))))
-                (t
-                 (error "Sorry, don't know how to kill things for `%s'" cat)))))
+             (cat (icomplete--category)))
         (when (let (;; Allow `yes-or-no-p' to work and don't let it
                     ;; `icomplete-exhibit' anything.
                     (enable-recursive-minibuffers t)
                     (icomplete-mode nil))
-                (funcall action))
+                (icomplete-kill-candidate cat thing))
           (completion--cache-all-sorted-completions
            (icomplete--field-beg)
            (icomplete--field-end)

--=-=-=--





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 14 Sep 2024 07:43:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 03:43:01 2024
Received: from localhost ([127.0.0.1]:44688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spNQr-0003Ck-2o
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 03:43:01 -0400
Received: from eggs.gnu.org ([209.51.188.92]:60254)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1spNQp-0003CU-4F
 for 72210 <at> debbugs.gnu.org; Sat, 14 Sep 2024 03:42:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1spNQZ-0001d2-Av; Sat, 14 Sep 2024 03:42:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=5ydfQMuYWmeCZLhm9ePcHDclnUrID8MKA8MSrsozV3M=; b=luGIP1xJyOf4bmryL/uV
 UKAp80CV2tIjuqejKxEChWA0VOy3NL6ZuAYUaqhqHs7pkknha6HsJdPWsJbixHb2uixwmr7ltXMKr
 jDTXkgWuRtFJ/+QDaN/QjiUy1Ar2jTALZNb6Mxfi8GsG6TzOgbCeeOjgklm5oiIKtXn6+1QiOAV4N
 gahY68yErZuzPTKFd/qEMaH5UPnXlDV0CUnuFijRqfzKpE3EfYbImGV04TocXHQ8CDcH/9xDToQoF
 9AQbL9F8K7m9sPHq1SzLnk+0Ckc8qgW+kqb7TmAu42XpZSCUmc7mDAjaXvjI5Qf2TeJwtmnMCutK5
 /FQZGO993xEa7Q==;
Date: Sat, 14 Sep 2024 10:42:41 +0300
Message-Id: <867cbeisum.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: monnier@HIDDEN,
 Fernando de Morais <fernandodemorais.jf@HIDDEN>
In-Reply-To: <87r0a258js.fsf@HIDDEN> (message from Fernando de Morais on
 Mon, 02 Sep 2024 13:23:19 -0300)
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
 <87r0a258js.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 72210 <at> debbugs.gnu.org
> From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> Date: Mon, 02 Sep 2024 13:23:19 -0300
> 
> Stefan Monnier <monnier@HIDDEN> writes:
> 
> >> `icomplete-fido-kill' works very well, but cannot handle the deletion of
> >> files or killing buffers when they are behind a multi-category
> >> ``situation''.  Add this would be useful for those of us that combine
> >> `icomplete' with, e.g., `consult-buffer'.
> >
> > Can you provide a recipe?  I'm not sufficiently familiar with that code
> > to really understand the problem you're facing.
> 
> Sure!
> 
> Please, install the `consult' package and, in an emacs -Q session,
> evaluate the following:
> 
> #+begin_src emacs-lisp
> (progn
>   (package-initialize)
>   (load-library "consult")
>   (icomplete-vertical-mode t)
>   (keymap-set icomplete-minibuffer-map "C-k" 'icomplete-fido-kill))
> #+end_src
> 
> - Then, ``M-x consult-buffer'';
> - Type *M (this should turn the `*Messages*' buffer the current
>   candidate);
> - Then ``C-k''
> 
> The following message should appear in the minibuffer:
> 
> [Sorry, don’t know how to kill things for ‘multi-category’]
> 
> The same happens when we try to use `icomplete-fido-kill' in files
> listed by `consult-buffer'.
> 
> The expected result would be for `icomplete-fido-kill' to work normally,
> killing the buffer, even though it is listed by `consult-buffer'.
> 
> >> What follows is just the ``hacky'' approach that's currently being used
> >> in my init:
> >
> > Any chance you can make it a patch against `icomplete.el`?
> 
> Follows attached!  This is my first patch, so I might have made
> mistakes, but I'm here to adjust whatever you deem necessary.

Stefan, any comments on the patch, or should I install it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 2 Sep 2024 16:27:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 02 12:27:01 2024
Received: from localhost ([127.0.0.1]:50006 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sl9tM-0004Fl-UH
	for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 12:27:01 -0400
Received: from mail-oo1-f54.google.com ([209.85.161.54]:58678)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fernandodemorais.jf@HIDDEN>) id 1sl9tL-0004FP-94
 for 72210 <at> debbugs.gnu.org; Mon, 02 Sep 2024 12:27:00 -0400
Received: by mail-oo1-f54.google.com with SMTP id
 006d021491bc7-5dca990cf58so2760586eaf.1
 for <72210 <at> debbugs.gnu.org>; Mon, 02 Sep 2024 09:25:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1725294292; x=1725899092; darn=debbugs.gnu.org;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=v0a6a8p7obmTc/AwXLGiLPjiLlJT0PwB5pYOn5yW8Bo=;
 b=hX0393teLe/alt+j+axINA4NQGdnrapPvAPotVYfXTZJsjCia7ID1G6BLBgrfBpZ0d
 vtvH13JV1FKmyVSxGNZqw/g7Y+MzY8frM0EVoFPuGfWQwUXAg0lz7DQBaeI/foYHbIYS
 JcDRuflihuMWj5ZrtipSNe0sOIAiWj+GG6DNeiJV0kyZIjVKv6JNOBOZRytgcTgcA9Qa
 e61y5rUTjyb6VKTxEwyov0ACnZ3igmu2hsfLRJZOU5/gTk5shlaDHlA9lW1txPcfKlzU
 vew7sWmQSFAsbliqelbFW+hh0wZNDs24Tv8g5hjaupc6ql/opJrY9Lcm9BakGDoMAzO6
 gjNg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1725294292; x=1725899092;
 h=mime-version:user-agent:references:message-id:date:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=v0a6a8p7obmTc/AwXLGiLPjiLlJT0PwB5pYOn5yW8Bo=;
 b=EGSIGPez9hCrK9YgPvxQLsYyZT/QdoV7kG7Bbowm1EhqJ2SrlgIEElcF37E1g+e7Ch
 dzSpiigyakuIz3G/vaZZ9bsEvgvHCN90FIe4gmHchEa+2BG/kyzObfT9VU9VrXK2U/m4
 xyHlsfGKZ6cM1gw9xkRHdek+YWyBgYP8MJdUACWglUwB7sUaxVMcdIJm6tSuoS+t1x5Q
 +vEZJOFrejEhRzXiBbW1vAbO+SWbVa6wrfAWKAib0FsG5RCrSg7dHG9w0H0iY2Ugud4f
 PpCPUXBlofxOBjZKAXKpL3CXMUqV6h2UHB6dHfkbvijTokNo4WtckcqjQFuCqdB7FLii
 xPhQ==
X-Gm-Message-State: AOJu0YwZ4EyK1XFJAgVg5B2XfDKarFbw+zUuM8PPPDPobB4xQNW+dUOP
 4k9flLBOedrc9cWP7R1f2zz8QCDdgFQBKSPtygCDXeEVX/EGcqgMeCGG2w==
X-Google-Smtp-Source: AGHT+IG9TO7CxaEZ1koPdtlZa4e2ZkInwNR6UAreIXPKd/4dP9AyNxPWMNJCCGwMqCPUzOrTOsjJqg==
X-Received: by 2002:a05:6870:b506:b0:269:2708:afed with SMTP id
 586e51a60fabf-27800333f2fmr2833064fac.30.1725294291796; 
 Mon, 02 Sep 2024 09:24:51 -0700 (PDT)
Received: from sekai ([2804:14c:da80:83fa::7066])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-715e5749b51sm7045784b3a.184.2024.09.02.09.24.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 02 Sep 2024 09:24:50 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'.
In-Reply-To: <jwvttezo2li.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Sun, 01 Sep 2024 10:46:09 -0400")
Date: Mon, 02 Sep 2024 13:23:19 -0300
Message-ID: <87r0a258js.fsf@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN> <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72210
Cc: 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello Stefan,

Stefan Monnier <monnier@HIDDEN> writes:

>> `icomplete-fido-kill' works very well, but cannot handle the deletion of
>> files or killing buffers when they are behind a multi-category
>> ``situation''.  Add this would be useful for those of us that combine
>> `icomplete' with, e.g., `consult-buffer'.
>
> Can you provide a recipe?  I'm not sufficiently familiar with that code
> to really understand the problem you're facing.

Sure!

Please, install the `consult' package and, in an emacs -Q session,
evaluate the following:

#+begin_src emacs-lisp
(progn
  (package-initialize)
  (load-library "consult")
  (icomplete-vertical-mode t)
  (keymap-set icomplete-minibuffer-map "C-k" 'icomplete-fido-kill))
#+end_src

- Then, ``M-x consult-buffer'';
- Type *M (this should turn the `*Messages*' buffer the current
  candidate);
- Then ``C-k''

The following message should appear in the minibuffer:

[Sorry, don=E2=80=99t know how to kill things for =E2=80=98multi-category=
=E2=80=99]

The same happens when we try to use `icomplete-fido-kill' in files
listed by `consult-buffer'.

The expected result would be for `icomplete-fido-kill' to work normally,
killing the buffer, even though it is listed by `consult-buffer'.

>> What follows is just the ``hacky'' approach that's currently being used
>> in my init:
>
> Any chance you can make it a patch against `icomplete.el`?

Follows attached!  This is my first patch, so I might have made
mistakes, but I'm here to adjust whatever you deem necessary.

--=20
Regards,
Fernando de Morais.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Add-support-for-multi-category-to-icomplete-fido-kil.patch

From 7fd715580d70d1c7cb7dbbe3035a439c4d06c49d Mon Sep 17 00:00:00 2001
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Date: Mon, 2 Sep 2024 13:14:04 -0300
Subject: [PATCH] Add support for multi-category to icomplete-fido-kill

* etc/NEWS: Announce the multi-category support in 'icomplete-fido-kill'.
* lisp/icomplete.el (icomplete--refine-multi-category): New function.
(icomplete-fido-kill): Apply the helper function to refine
'multi-category' to its actual type.
---
 etc/NEWS          |  7 +++++++
 lisp/icomplete.el | 16 ++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 1e66f084117..86c2995cf19 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -65,6 +65,13 @@ different values for completion-affecting variables like
 applies for the styles configuration in 'completion-category-overrides'
 and 'completion-category-defaults'.
 
+** Icomplete
+
+---
+*** 'icomplete-fido-kill' now works within multi-category environments.
+This function can now delete a file or kill a buffer within a
+multi-category environment, such as 'consult-buffer'.
+
 ** Windows
 
 +++
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2ea5e36fa88..1ef861ff270 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -317,6 +317,16 @@ Return non-nil if something was stepped."
 
 ;;;_* Helpers for `fido-mode' (or `ido-mode' emulation)
 
+(defun icomplete--refine-multi-category (target)
+  "Refine `multi-category' TARGET to its actual type."
+  (or (let ((mc (get-text-property 0 'multi-category target)))
+        (cond
+         ;; The `cdr' of the `multi-category' property can be a buffer object.
+         ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
+  	(cons 'buffer (buffer-name (cdr mc))))
+         ((stringp (cdr mc)) mc)))
+      (cons 'general target)))
+
 (defun icomplete-fido-kill ()
   "Kill line or current completion, like `ido-mode'.
 If killing to the end of line make sense, call `kill-line',
@@ -330,8 +340,10 @@ require user confirmation."
     (if (< (point) end)
         (call-interactively 'kill-line)
       (let* ((all (completion-all-sorted-completions))
-             (thing (car all))
-             (cat (icomplete--category))
+             (refined-pair (when (eq 'multi-category (icomplete--category))
+                             (icomplete--refine-multi-category (car all))))
+             (cat (or (car-safe refined-pair) (icomplete--category)))
+             (thing (or (cdr-safe refined-pair) (car all)))
              (action
               (cl-case cat
                 (buffer
-- 
2.46.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 1 Sep 2024 14:47:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 01 10:47:23 2024
Received: from localhost ([127.0.0.1]:36106 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sklrO-00029R-Mq
	for submit <at> debbugs.gnu.org; Sun, 01 Sep 2024 10:47:22 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53953)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1sklrN-00028u-Ct
 for 72210 <at> debbugs.gnu.org; Sun, 01 Sep 2024 10:47:22 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E848B441C46;
 Sun,  1 Sep 2024 10:46:15 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1725201970;
 bh=2EBmySbkl+7YzRzaMDIJRi5UtZUdUBOYxPCa7NlNyhg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=M/4uKxGBV+QEb2hkKvkc/0TC8EVUaIaWGk1j3YFallDUpkOd3FHeBacizpSMHtj1F
 c/m8uALf5Gu89+n31VghUigSi1HxYo8szCONVEM7kNH6pjATducKnJEZlaYeMI8Ces
 jlTGiWkIpTUs4vm9cLJiA9CQq7t20bEOiaJ1OMHAhkwWMnHPnuTBKJiONTEwHRxVch
 sPYxESl0iyKk11u5jHi7ZeZR6+L4Dm48a+UNNOlUt5x0paihcYkaOnKQ8aQ/IXpWu7
 NOP8ZUC5+XLTXEI+UmU4XUhNivQAKflXMvgt3HyVqXSvD3icaYs3/cmIwS1DBg+pCQ
 9yZs+sMKSrHVA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 18D4644106A;
 Sun,  1 Sep 2024 10:46:10 -0400 (EDT)
Received: from pastel (104-195-234-246.cpe.teksavvy.com [104.195.234.246])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E2F771202BE;
 Sun,  1 Sep 2024 10:46:09 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Subject: Re: bug#72210: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'.
In-Reply-To: <87ttgk16tg.fsf@HIDDEN> (Fernando de Morais's message of "Sat, 
 20 Jul 2024 11:22:51 -0300")
Message-ID: <jwvttezo2li.fsf-monnier+emacs@HIDDEN>
References: <87ttgk16tg.fsf@HIDDEN>
Date: Sun, 01 Sep 2024 10:46:09 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> `icomplete-fido-kill' works very well, but cannot handle the deletion of
> files or killing buffers when they are behind a multi-category
> ``situation''.  Add this would be useful for those of us that combine
> `icomplete' with, e.g., `consult-buffer'.

Can you provide a recipe?  I'm not sufficiently familiar with that code
to really understand the problem you're facing.

> What follows is just the ``hacky'' approach that's currently being used
> in my init:

Any chance you can make it a patch against `icomplete.el`?


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 1 Sep 2024 04:52:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 01 00:52:23 2024
Received: from localhost ([127.0.0.1]:60703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1skcZa-0000vN-VW
	for submit <at> debbugs.gnu.org; Sun, 01 Sep 2024 00:52:23 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40470)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1skcZZ-0000v7-43
 for 72210 <at> debbugs.gnu.org; Sun, 01 Sep 2024 00:52:21 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1skcWH-0000GE-B7; Sun, 01 Sep 2024 00:49:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=zkQfVzEOlp3SmK1TkYcgtf+r0CTseOV2Z/R7ltAQYbA=; b=QdANsThRUhsNfEFH3MDr
 9KL78mL55XV6y5aS1itMtQqBSKFv18CDWavESnXj0OEvoWTMRTzQlDoY/0bcVGjg/j/z4bAnadK1y
 CjGVwD74ftY7vmjWcxYAvjp18CFRm+ALh9b4yDqsS17DZ7lsvaeV6aw2FXc1sXRVzVAdyiEKkCWPi
 0n4fucDAUwqxUJnR27569fUSwaZUz2KrMpfRE9K+VA3Z59hJhrCtZZHWo3+AUyaiU7/2Vr4opvopM
 Q3vkATDcRbZwT5CFdmktdI5cxcSJDWp4LFXdbv93WgMIX48dzpEZWo/kYG4LKSfU1RvJOJ1CNBaj6
 ff0cww1FNepBhg==;
Date: Sun, 01 Sep 2024 07:48:55 +0300
Message-Id: <861q24asi0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CALDnm53s8GXe5oWoRQpXg9ySAazJG6A9TSf2YrKZTb5nyiSxxg@HIDDEN>
 (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Sat, 31 Aug 2024 23:14:04
 +0100)
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
References: <87ttgk16tg.fsf@HIDDEN> <86bk2l6hoo.fsf@HIDDEN>
 <86sev34ln5.fsf@HIDDEN> <86ttf1cef8.fsf@HIDDEN>
 <CALDnm53s8GXe5oWoRQpXg9ySAazJG6A9TSf2YrKZTb5nyiSxxg@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: João Távora <joaotavora@HIDDEN>
> Date: Sat, 31 Aug 2024 23:14:04 +0100
> Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
> 
> On Sat, Aug 31, 2024 at 8:57 AM Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > Ping! Ping! João, please respond.
> 
> I'll not be implementing this.  Might be a good idea, who knows.  Maybe
> ask Stefan for his opinion.

Thanks.

Stefan?

If no one thinks this is a good idea, I guess we should close this as
wontfix?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 31 Aug 2024 22:14:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 31 18:14:54 2024
Received: from localhost ([127.0.0.1]:58377 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1skWMv-0006iR-WE
	for submit <at> debbugs.gnu.org; Sat, 31 Aug 2024 18:14:54 -0400
Received: from mail-oa1-f50.google.com ([209.85.160.50]:51321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1skWMt-0006iD-Cg
 for 72210 <at> debbugs.gnu.org; Sat, 31 Aug 2024 18:14:52 -0400
Received: by mail-oa1-f50.google.com with SMTP id
 586e51a60fabf-277c861d9f6so685725fac.2
 for <72210 <at> debbugs.gnu.org>; Sat, 31 Aug 2024 15:13:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1725142367; x=1725747167; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=OSmhnyQ4F8jBv7V1nF3BO2+UrUq0Va7qCGJNf/O5W4M=;
 b=VJUlPzHhM8oV1Ag67ZCxuGRoKk12OvoL6JRHy3riJJ3mHcCzdWAM2YGuYzLaIAfd6a
 6jyxRkkDY54RT/SyGjVXx1lUExLu/SyzsFf38uSIymOJUYCSkjzjC9nOXFXxXKJBjFwT
 w+ZFdCebGJ53mF3NXodWIapd4pnXqcXeAuo767PCACXNpyxmIA4dMiEi4i3L7W8PFNZT
 eWUYIX4WzNIKbKEUjB4rdlYH3wpsCAMZTts6DKkVYx9VYobkHA16GzEHBzKg25sxVeIu
 H22vMNOoPTAgyPvH/8OKRYP2IrVUmMU2QihH5+rn8odwsTyEgCU6bntH+NSZeMB67tFD
 QiFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1725142367; x=1725747167;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=OSmhnyQ4F8jBv7V1nF3BO2+UrUq0Va7qCGJNf/O5W4M=;
 b=q9HC5l1ArYWIF6Te5LluCP5dNGaHOWx0MAgy+g3YR6B/7S24H7KpPEjOaPwXGafOUI
 Akcb3lJo7KDJKYD3N5ppNjYsY3I1mr0RP0RJrQi8VV4oJN+Ydzl1+merSoZnCbWZpV7G
 eWsg/mhLp2bpO5fZG2mCxM85Sg9VYk6QdCFR5qReKNU7SWvzpr2AvRrz0WcWKplb3EnM
 ivza2KrT+D3rpJidHprmMWah4vsFDnhrgXIxCwrBD44YiGM05MCyhrCh15f4NXtOKhyz
 15qlTsQqTuGl+mOZuOFdeuGFrBX5VJHfWFLYJannH1V4FSckAHF/qTZdMCW1nYxAvRE5
 lR+w==
X-Forwarded-Encrypted: i=1;
 AJvYcCWYMTBBPAJLjD7h9Je5Ge2pnOtvSLcl/P+OjI+Ity27LzbEcapNDPCHlUGv7OCUm/7VRx4/+A==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxxwkiBSGG0RWocd/1iPQznHbWYClQ3G8JuPdMPXH20X6vExNxv
 gELb4oZM4AZlxUgJ0LvM6wnK/mZQSeDuaFNv/2c4UkedL/s4OCp0vkZBdA4cCkwTxi1tw1f5Dty
 u6RcCU4EfgQY1CALCW1BzI6fJAmM=
X-Google-Smtp-Source: AGHT+IE/phX70iGdCFY1ckgEoDXU19ylo2G1LoIGC9dOu1P3OmmJtRsZzhjxe1JZxzarcdU4JkqKQbvbtR2DEqLB8pY=
X-Received: by 2002:a05:6871:7828:b0:25d:8d4:68ab with SMTP id
 586e51a60fabf-277902bfc25mr11489432fac.40.1725142366863; Sat, 31 Aug 2024
 15:12:46 -0700 (PDT)
MIME-Version: 1.0
References: <87ttgk16tg.fsf@HIDDEN> <86bk2l6hoo.fsf@HIDDEN>
 <86sev34ln5.fsf@HIDDEN> <86ttf1cef8.fsf@HIDDEN>
In-Reply-To: <86ttf1cef8.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Sat, 31 Aug 2024 23:14:04 +0100
Message-ID: <CALDnm53s8GXe5oWoRQpXg9ySAazJG6A9TSf2YrKZTb5nyiSxxg@HIDDEN>
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72210
Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, Aug 31, 2024 at 8:57=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> Ping! Ping! Jo=C3=A3o, please respond.

I'll not be implementing this.  Might be a good idea, who knows.  Maybe
ask Stefan for his opinion.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 31 Aug 2024 07:59:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 31 03:59:01 2024
Received: from localhost ([127.0.0.1]:53840 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1skJ0f-000678-30
	for submit <at> debbugs.gnu.org; Sat, 31 Aug 2024 03:59:01 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40528)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1skJ0d-00066r-Kv
 for 72210 <at> debbugs.gnu.org; Sat, 31 Aug 2024 03:59:00 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1skIzc-0004mi-HR; Sat, 31 Aug 2024 03:57:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=4WPiKMDy7Q5VlIbPF87gGGUHKrh8FMiEmaDOl8AJExg=; b=LRoahVYoCPCLeO7l6aeD
 Pj4T0dTlipmNObwqEQhQ9NFmU3MEa8j399M3xYBM8RJNgNq8TC8U+j53voVK+NW/D07mDVXaoplJc
 Kt7ENuHtf/1BXQxNAHxjZhiE/usVbbjolq/GxAcji16MQWxoC65JGqcb5XkZC8+xzt5C00MM3M/uM
 RQJDQETNgD/x8MIFuw4EBsn8mwDInAbPdKEVvM2dcagO34CIlgerfgOeLhree9wKJiDq/h3tCWd30
 qiSS0ev12jIs1a48R7w2j2WyzGyLQ+V6P4N+58HCXJofgea8qTEMhI1Laz6rhpCGmDyzrFuFVS7Oj
 gF4yYJjNUtYzbA==;
Date: Sat, 31 Aug 2024 10:57:47 +0300
Message-Id: <86ttf1cef8.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: joaotavora@HIDDEN
In-Reply-To: <86sev34ln5.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 17
 Aug 2024 11:08:14 +0300)
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
References: <87ttgk16tg.fsf@HIDDEN> <86bk2l6hoo.fsf@HIDDEN>
 <86sev34ln5.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping! Ping! João, please respond.

> Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
> Date: Sat, 17 Aug 2024 11:08:14 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> Ping!  João, any comments to this issue?
> 
> > Cc: 72210 <at> debbugs.gnu.org
> > Date: Thu, 25 Jul 2024 10:42:47 +0300
> > From: Eli Zaretskii <eliz@HIDDEN>
> > 
> > > From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> > > Date: Sat, 20 Jul 2024 11:22:51 -0300
> > > 
> > > Dear maintainers,
> > > 
> > > `icomplete-fido-kill' works very well, but cannot handle the deletion of
> > > files or killing buffers when they are behind a multi-category
> > > ``situation''.  Add this would be useful for those of us that combine
> > > `icomplete' with, e.g., `consult-buffer'.
> > > 
> > > What follows is just the ``hacky'' approach that's currently being used
> > > in my init:
> > > 
> > > #+begin_src emacs-lisp
> > >   ;; Stolen from Embark <https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/embark.el?h=externals/embark#n2108>
> > >   (defun icomplete--refine-multi-category (target)
> > >     "Refine `multi-category' TARGET to its actual type."
> > >     (or (let ((mc (get-text-property 0 'multi-category target)))
> > >   	(cond
> > >   	 ;; The `cdr' of the `multi-category' property can be a buffer object.
> > >   	 ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
> > >   	  (cons 'buffer (buffer-name (cdr mc))))
> > >   	 ((stringp (cdr mc)) mc)))
> > >         (cons 'general target)))
> > > 
> > >   (defun icomplete-fido-kill ()
> > >     "Kill line or current completion, like `ido-mode'.
> > >   If killing to the end of line make sense, call `kill-line',
> > >   otherwise kill the currently selected completion candidate.
> > >   Exactly what killing entails is dependent on the things being
> > >   completed.  If completing files, it means delete the file.  If
> > >   completing buffers it means kill the buffer.  Both actions
> > >   require user confirmation."
> > >     (interactive)
> > >     (let ((end (icomplete--field-end)))
> > >       (if (< (point) end)
> > >   	(call-interactively 'kill-line)
> > >         (let* ((all (completion-all-sorted-completions))
> > >   	     ;; Actual changes (
> > >   	     (refined-pair (when (eq 'multi-category (icomplete--category))
> > >   			     (icomplete--refine-multi-category (car all))))
> > >   	     (cat (or (car-safe refined-pair) (icomplete--category)))
> > >   	     (thing (or (cdr-safe refined-pair) (car all)))
> > >   	     ;; )
> > >   	     (action
> > >   	      (cl-case cat
> > >   		(buffer
> > >   		 (lambda ()
> > >   		   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
> > >   		     (kill-buffer thing))))
> > >   		((project-file file)
> > >   		 (lambda ()
> > >   		   (let* ((dir (file-name-directory
> > >   				(icomplete--field-string)))
> > >   			  (path (expand-file-name thing dir)))
> > >   		     (when (yes-or-no-p (concat "Delete file " path "? "))
> > >   		       (delete-file path) t))))
> > >   		(t
> > >   		 (error "Sorry, don't know how to kill things for `%s'"
> > >   			cat)))))
> > >   	(when (let (;; Allow `yes-or-no-p' to work and don't let it
> > >   		    ;; `icomplete-exhibit' anything.
> > >   		    (enable-recursive-minibuffers t)
> > >   		    (icomplete-mode nil))
> > >   		(funcall action))
> > >   	  (completion--cache-all-sorted-completions
> > >   	   (icomplete--field-beg)
> > >   	   (icomplete--field-end)
> > >   	   (cdr all)))
> > >   	(message nil)))))
> > > #+end_src
> > > 
> > > Thank you for any consideration on the matter.
> > 
> > João, any comments?
> > 
> > 
> > 
> > 
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 17 Aug 2024 08:09:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 17 04:09:05 2024
Received: from localhost ([127.0.0.1]:53356 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sfEUj-0000Io-EJ
	for submit <at> debbugs.gnu.org; Sat, 17 Aug 2024 04:09:05 -0400
Received: from eggs.gnu.org ([209.51.188.92]:58588)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sfEUh-0000IB-Ef
 for 72210 <at> debbugs.gnu.org; Sat, 17 Aug 2024 04:09:03 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sfETz-0001ap-GS; Sat, 17 Aug 2024 04:08:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=bFEQHa6exQBtA/I3/J7f7lu+H8glDDQmsbsHq8sUg2I=; b=fzM5R4QXGz1PnVDwEfG6
 1FbGP8z1UpCNJ+oRIisiJwLdSO7H/S7YkRGCQfTfm+G6U42XXUtZ0h8GkEFPp+0nw42zHGZMQVQWH
 NY0vd8erifi6g5d5L+kDeJA0m3Ik7VcAyr3UKpn5UGnjR/MzKOhC4BdkmIenqcx6UP0mo5JmHUlJ8
 pMfVtH6d5BBiroLpw6zvdLv7YnelO4Sl1cqcZ/y+tmjdmH1+8V0EHrcvskHyXQjmF8sqUZWddPKQy
 Zevm+DhR+rh4t1KBb5R3nLtUmneA8bu6pjsDBZ7/1niuErhzpYkdil+PhDNsVRcQpPXAPVqRFQWst
 S+oFCiYMA9G7/w==;
Date: Sat, 17 Aug 2024 11:08:14 +0300
Message-Id: <86sev34ln5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: joaotavora@HIDDEN
In-Reply-To: <86bk2l6hoo.fsf@HIDDEN> (message from Eli Zaretskii on Thu, 25
 Jul 2024 10:42:47 +0300)
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
References: <87ttgk16tg.fsf@HIDDEN> <86bk2l6hoo.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: fernandodemorais.jf@HIDDEN, 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping!  João, any comments to this issue?

> Cc: 72210 <at> debbugs.gnu.org
> Date: Thu, 25 Jul 2024 10:42:47 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> > Date: Sat, 20 Jul 2024 11:22:51 -0300
> > 
> > Dear maintainers,
> > 
> > `icomplete-fido-kill' works very well, but cannot handle the deletion of
> > files or killing buffers when they are behind a multi-category
> > ``situation''.  Add this would be useful for those of us that combine
> > `icomplete' with, e.g., `consult-buffer'.
> > 
> > What follows is just the ``hacky'' approach that's currently being used
> > in my init:
> > 
> > #+begin_src emacs-lisp
> >   ;; Stolen from Embark <https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/embark.el?h=externals/embark#n2108>
> >   (defun icomplete--refine-multi-category (target)
> >     "Refine `multi-category' TARGET to its actual type."
> >     (or (let ((mc (get-text-property 0 'multi-category target)))
> >   	(cond
> >   	 ;; The `cdr' of the `multi-category' property can be a buffer object.
> >   	 ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
> >   	  (cons 'buffer (buffer-name (cdr mc))))
> >   	 ((stringp (cdr mc)) mc)))
> >         (cons 'general target)))
> > 
> >   (defun icomplete-fido-kill ()
> >     "Kill line or current completion, like `ido-mode'.
> >   If killing to the end of line make sense, call `kill-line',
> >   otherwise kill the currently selected completion candidate.
> >   Exactly what killing entails is dependent on the things being
> >   completed.  If completing files, it means delete the file.  If
> >   completing buffers it means kill the buffer.  Both actions
> >   require user confirmation."
> >     (interactive)
> >     (let ((end (icomplete--field-end)))
> >       (if (< (point) end)
> >   	(call-interactively 'kill-line)
> >         (let* ((all (completion-all-sorted-completions))
> >   	     ;; Actual changes (
> >   	     (refined-pair (when (eq 'multi-category (icomplete--category))
> >   			     (icomplete--refine-multi-category (car all))))
> >   	     (cat (or (car-safe refined-pair) (icomplete--category)))
> >   	     (thing (or (cdr-safe refined-pair) (car all)))
> >   	     ;; )
> >   	     (action
> >   	      (cl-case cat
> >   		(buffer
> >   		 (lambda ()
> >   		   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
> >   		     (kill-buffer thing))))
> >   		((project-file file)
> >   		 (lambda ()
> >   		   (let* ((dir (file-name-directory
> >   				(icomplete--field-string)))
> >   			  (path (expand-file-name thing dir)))
> >   		     (when (yes-or-no-p (concat "Delete file " path "? "))
> >   		       (delete-file path) t))))
> >   		(t
> >   		 (error "Sorry, don't know how to kill things for `%s'"
> >   			cat)))))
> >   	(when (let (;; Allow `yes-or-no-p' to work and don't let it
> >   		    ;; `icomplete-exhibit' anything.
> >   		    (enable-recursive-minibuffers t)
> >   		    (icomplete-mode nil))
> >   		(funcall action))
> >   	  (completion--cache-all-sorted-completions
> >   	   (icomplete--field-beg)
> >   	   (icomplete--field-end)
> >   	   (cdr all)))
> >   	(message nil)))))
> > #+end_src
> > 
> > Thank you for any consideration on the matter.
> 
> João, any comments?
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at 72210 <at> debbugs.gnu.org:


Received: (at 72210) by debbugs.gnu.org; 25 Jul 2024 07:43:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 25 03:43:05 2024
Received: from localhost ([127.0.0.1]:35435 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWt7w-0005gF-IS
	for submit <at> debbugs.gnu.org; Thu, 25 Jul 2024 03:43:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59846)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sWt7v-0005fe-7G
 for 72210 <at> debbugs.gnu.org; Thu, 25 Jul 2024 03:43:03 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sWt7i-0001fq-K9; Thu, 25 Jul 2024 03:42:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=kXDay9McJHDKaeiHlnDkfvI7uE8fbv6eD623HbORUVU=; b=ge+hBOUc6V7zKdzvg5Ln
 //uYZL2WY9t9eKtMAoTjREiOwUhwrAyvPsraGL1mdyZbMNEU9n4PCE3cDvTY+ICUKfFCszGRPCArA
 vMJjGyJv1bkjsvTzD3WhnpYvswSb3hF3kerX3C3POEMgu+bS74+Z3GjsqB5/ym/cM4FIabgyAlJqv
 NvFnP2wz/yRZFxomsbzjmoPFTCUNAr5KbSk3q2+ySgvZtiRebQ9bcpu/Op07mVD2wiLHAoas4NFej
 AFZKYH+ypj1fvXhSBVJfeqrKore5rooAgA8pIPdWuNIcP8pVCQOu4VNmHjMOIa24vF++5r92I+OIr
 nAR5kqD8UpmJug==;
Date: Thu, 25 Jul 2024 10:42:47 +0300
Message-Id: <86bk2l6hoo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
In-Reply-To: <87ttgk16tg.fsf@HIDDEN> (message from Fernando de Morais on
 Sat, 20 Jul 2024 11:22:51 -0300)
Subject: Re: bug#72210: 31.0.50;
 Feature request: multi-category support in `icomplete-fido-kill'.
References: <87ttgk16tg.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72210
Cc: 72210 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> Date: Sat, 20 Jul 2024 11:22:51 -0300
> 
> Dear maintainers,
> 
> `icomplete-fido-kill' works very well, but cannot handle the deletion of
> files or killing buffers when they are behind a multi-category
> ``situation''.  Add this would be useful for those of us that combine
> `icomplete' with, e.g., `consult-buffer'.
> 
> What follows is just the ``hacky'' approach that's currently being used
> in my init:
> 
> #+begin_src emacs-lisp
>   ;; Stolen from Embark <https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/embark.el?h=externals/embark#n2108>
>   (defun icomplete--refine-multi-category (target)
>     "Refine `multi-category' TARGET to its actual type."
>     (or (let ((mc (get-text-property 0 'multi-category target)))
>   	(cond
>   	 ;; The `cdr' of the `multi-category' property can be a buffer object.
>   	 ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
>   	  (cons 'buffer (buffer-name (cdr mc))))
>   	 ((stringp (cdr mc)) mc)))
>         (cons 'general target)))
> 
>   (defun icomplete-fido-kill ()
>     "Kill line or current completion, like `ido-mode'.
>   If killing to the end of line make sense, call `kill-line',
>   otherwise kill the currently selected completion candidate.
>   Exactly what killing entails is dependent on the things being
>   completed.  If completing files, it means delete the file.  If
>   completing buffers it means kill the buffer.  Both actions
>   require user confirmation."
>     (interactive)
>     (let ((end (icomplete--field-end)))
>       (if (< (point) end)
>   	(call-interactively 'kill-line)
>         (let* ((all (completion-all-sorted-completions))
>   	     ;; Actual changes (
>   	     (refined-pair (when (eq 'multi-category (icomplete--category))
>   			     (icomplete--refine-multi-category (car all))))
>   	     (cat (or (car-safe refined-pair) (icomplete--category)))
>   	     (thing (or (cdr-safe refined-pair) (car all)))
>   	     ;; )
>   	     (action
>   	      (cl-case cat
>   		(buffer
>   		 (lambda ()
>   		   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
>   		     (kill-buffer thing))))
>   		((project-file file)
>   		 (lambda ()
>   		   (let* ((dir (file-name-directory
>   				(icomplete--field-string)))
>   			  (path (expand-file-name thing dir)))
>   		     (when (yes-or-no-p (concat "Delete file " path "? "))
>   		       (delete-file path) t))))
>   		(t
>   		 (error "Sorry, don't know how to kill things for `%s'"
>   			cat)))))
>   	(when (let (;; Allow `yes-or-no-p' to work and don't let it
>   		    ;; `icomplete-exhibit' anything.
>   		    (enable-recursive-minibuffers t)
>   		    (icomplete-mode nil))
>   		(funcall action))
>   	  (completion--cache-all-sorted-completions
>   	   (icomplete--field-beg)
>   	   (icomplete--field-end)
>   	   (cdr all)))
>   	(message nil)))))
> #+end_src
> 
> Thank you for any consideration on the matter.

João, any comments?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Jul 2024 14:25:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 20 10:25:19 2024
Received: from localhost ([127.0.0.1]:53732 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVB1T-0005IS-I4
	for submit <at> debbugs.gnu.org; Sat, 20 Jul 2024 10:25:19 -0400
Received: from lists.gnu.org ([209.51.188.17]:33156)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fernandodemorais.jf@HIDDEN>) id 1sVB1R-0005II-VN
 for submit <at> debbugs.gnu.org; Sat, 20 Jul 2024 10:25:18 -0400
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 <fernandodemorais.jf@HIDDEN>)
 id 1sVB1R-0000zU-AK
 for bug-gnu-emacs@HIDDEN; Sat, 20 Jul 2024 10:25:17 -0400
Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <fernandodemorais.jf@HIDDEN>)
 id 1sVB1P-00050e-21
 for bug-gnu-emacs@HIDDEN; Sat, 20 Jul 2024 10:25:17 -0400
Received: by mail-pl1-x636.google.com with SMTP id
 d9443c01a7336-1fc52394c92so24610055ad.1
 for <bug-gnu-emacs@HIDDEN>; Sat, 20 Jul 2024 07:25:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1721485510; x=1722090310; darn=gnu.org;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=N64nzn8ajtInNbpUjpgb5OT8vxU1ClwcWtUKAaGQOFM=;
 b=g3AeA1qwoXtkMLlvWTFPS4l6+d4Yf/yWUFTkof2idMsyWWWKnT1BvgaBgnNzkQRxPc
 OBNjn718tW1i6y5q6IDQLX8qWZ57cPYFWvaupvPcuAx0beYybZHBVro4B6kg7QlXF/S5
 ypOaUmQN4fStsa9OSqzD2/steP0G28x1tR4Kr2ljExP0yq/i7rVDTysB4ix5647IzUYD
 SWUJC+KdCPus3X80TS9RkI7HpAu6g9HIm49BgWsCRoJtA6msgjrpT6YvLepbjNXbq8Cq
 QrfPkkgsre49v3Cctuj+nV22PGZCT8ZRK2Dl7nj9+hoynlQOoSXjekXx0kmwZqppvckE
 htIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1721485510; x=1722090310;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=N64nzn8ajtInNbpUjpgb5OT8vxU1ClwcWtUKAaGQOFM=;
 b=RLwGZiEfVigbPvrhUoYgkEKxF0qXsHqpHeuyEOTufHgZkiJTYfB2vgPxAlqdCy0LHd
 3nMS75I0qutcdJlFoZoiYcQnKxW4MPG8/gP14jlPBqNA3ZkWHBaRAbrhhP4Skb0Ef/go
 9huNB8R3bkpcR5vOaQDlglDno+XQ34X9aPriKzLyUN3UxsNFzNHtHHmTixFuI2i+3Fc2
 eY9mHhgqPeken7Zy8EP/e2IRusp5l47LN4l9+rqJ/zgjpMnWoorS4I3RX8zsIUeEOVqU
 E4zfg2OGMLJLcilyrmdkF1ab87NQE0yyQeNufs0gZIKtV7XjCXJKECLT8J6H9UI7RVPN
 3LSA==
X-Gm-Message-State: AOJu0Yza3z4qRckOQRVMY0uOR+cppX7QF/ZTA9M0nJubq+zNzYT8hmza
 v4wpvhhEwSTceb2HV56I0tcQ0Iq19r0he7vOMAqbp06NooZi/gYd77uTRA==
X-Google-Smtp-Source: AGHT+IHTtSt15bVwEaz8+FrsDqlfXiij6jjCAsxURfXWxGu2XZ4WAH58+SPPtkQruoq+orVX6whZDQ==
X-Received: by 2002:a17:902:ecc5:b0:1fa:221b:a7ef with SMTP id
 d9443c01a7336-1fd7461f2e1mr31363435ad.41.1721485509746; 
 Sat, 20 Jul 2024 07:25:09 -0700 (PDT)
Received: from sekai ([2804:14c:da80:83fa::499c])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-1fd6f4647f5sm22441185ad.252.2024.07.20.07.25.08
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 20 Jul 2024 07:25:09 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; Feature request: multi-category support in
 `icomplete-fido-kill'.
Date: Sat, 20 Jul 2024 11:22:51 -0300
Message-ID: <87ttgk16tg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
X-Debbugs-Cc: 
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::636;
 envelope-from=fernandodemorais.jf@HIDDEN; helo=mail-pl1-x636.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Dear maintainers,

`icomplete-fido-kill' works very well, but cannot handle the deletion of
files or killing buffers when they are behind a multi-category
``situation''.  Add this would be useful for those of us that combine
`icomplete' with, e.g., `consult-buffer'.

What follows is just the ``hacky'' approach that's currently being used
in my init:

#+begin_src emacs-lisp
  ;; Stolen from Embark <https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/embark.el?h=externals/embark#n2108>
  (defun icomplete--refine-multi-category (target)
    "Refine `multi-category' TARGET to its actual type."
    (or (let ((mc (get-text-property 0 'multi-category target)))
  	(cond
  	 ;; The `cdr' of the `multi-category' property can be a buffer object.
  	 ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
  	  (cons 'buffer (buffer-name (cdr mc))))
  	 ((stringp (cdr mc)) mc)))
        (cons 'general target)))

  (defun icomplete-fido-kill ()
    "Kill line or current completion, like `ido-mode'.
  If killing to the end of line make sense, call `kill-line',
  otherwise kill the currently selected completion candidate.
  Exactly what killing entails is dependent on the things being
  completed.  If completing files, it means delete the file.  If
  completing buffers it means kill the buffer.  Both actions
  require user confirmation."
    (interactive)
    (let ((end (icomplete--field-end)))
      (if (< (point) end)
  	(call-interactively 'kill-line)
        (let* ((all (completion-all-sorted-completions))
  	     ;; Actual changes (
  	     (refined-pair (when (eq 'multi-category (icomplete--category))
  			     (icomplete--refine-multi-category (car all))))
  	     (cat (or (car-safe refined-pair) (icomplete--category)))
  	     (thing (or (cdr-safe refined-pair) (car all)))
  	     ;; )
  	     (action
  	      (cl-case cat
  		(buffer
  		 (lambda ()
  		   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
  		     (kill-buffer thing))))
  		((project-file file)
  		 (lambda ()
  		   (let* ((dir (file-name-directory
  				(icomplete--field-string)))
  			  (path (expand-file-name thing dir)))
  		     (when (yes-or-no-p (concat "Delete file " path "? "))
  		       (delete-file path) t))))
  		(t
  		 (error "Sorry, don't know how to kill things for `%s'"
  			cat)))))
  	(when (let (;; Allow `yes-or-no-p' to work and don't let it
  		    ;; `icomplete-exhibit' anything.
  		    (enable-recursive-minibuffers t)
  		    (icomplete-mode nil))
  		(funcall action))
  	  (completion--cache-all-sorted-completions
  	   (icomplete--field-beg)
  	   (icomplete--field-end)
  	   (cdr all)))
  	(message nil)))))
#+end_src

Thank you for any consideration on the matter.

-- 
Regards,
Fernando de Morais.




Acknowledgement sent to Fernando de Morais <fernandodemorais.jf@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72210; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 4 Apr 2025 19:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.