From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: My read-buffer-function doesn't work when called by switch-to-buffer Date: Sun, 12 Mar 2023 04:32:44 +0100 Message-ID: <874jqq63vn.fsf@web.de> References: <875yb8nvvk.fsf@gnu.org> <87y1o486wo.fsf@web.de> <87fsabslcj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19118"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 12 04:33:31 2023 Return-path: Envelope-to: geh-help-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 1pbCSg-0004ox-Ji for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Mar 2023 04:33:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbCS6-00022w-AH; Sat, 11 Mar 2023 22:32:54 -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 1pbCS4-0001zW-95 for help-gnu-emacs@gnu.org; Sat, 11 Mar 2023 22:32:52 -0500 Original-Received: from mout.web.de ([212.227.17.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbCS2-0005Sy-Gt; Sat, 11 Mar 2023 22:32:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1678591965; i=michael_heerdegen@web.de; bh=CQ09Hy21sH/jMeZqyoHMG4KSVfC2NY6bkhKf9V+92pk=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=hTdXFXtDxg/2cMpD63Yx4Za10wyjR/PeRud5WStVdgYkrsYe4X8bTkx9GBCtZd7kN V/QiWwwFsb8LWJ4de8r7bt2AWcCzzI+K2uCHizqWmsjtY4m5Gsv8yjjElSAODLiV+v 1YMvnHja07cb+o+ac/3b79ZMoHv46t1lEsCSNtnlPRNqDWzLz/uI1VYQPFc+wvdbpJ t/YI1mPsXa/LfaP05jNp48kNp/m7UgXlW+f+qw9aBHb3HQSvBZIArBFwtJfooCLB9J mrDXMox5HvaAyMDAmJPkgQ7EL6uGoD0x5bIW/2FWfJDw241kLfMssVpg5aeB/+KBkl ZO1UtHiBAf2+Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([178.14.74.115]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mi53D-1qEfvg1vRh-00e2Ab; Sun, 12 Mar 2023 04:32:45 +0100 In-Reply-To: <87fsabslcj.fsf@gnu.org> (Tassilo Horn's message of "Sat, 11 Mar 2023 09:58:11 +0100") X-Provags-ID: V03:K1:ZcIFqt5+ZUhokcVaEVMi0SVLTnai9KL9uBVNKsSELCVaDR0DVXE n6YlZtlI/fLwRZ8AuIi8/eTQx/79Z+eRO9lRxa+gVi+ub4u/E+LNcsoLO1/dAJ18ow/BS/s ei2GhMZ+VXVsZHlG/s1MlGCpDXRH/QI7nzfJV5vV50uSEKUzjhYcmvWKsepprXgSXNtyzMo aVw8Fh9QqKGjgaTS/ZYRg== UI-OutboundReport: notjunk:1;M01:P0:PgHVpGNlZ28=;LxP2bHCwGV0zmaH8V5tZggE74CZ CAXTwjeFLd3H9Aj8coQxoKRgYTQd49O/fV0hv2fvy+zjdBNMDbwG8hcJA8iBRAcqkr1S6AOEZ xcLilV+yjwC40/lIagduS1ZlUV+CcF/3e3RcYvOZoy76NWYGFsa9DDZIgYlYuN4H8yW5GZzDd 4VrbX98Jv+8UTmGalwl+MMQT9BMUtWvF6IUJdvLi4PuKq0+cUMzrz4YlDQ5LFdAAUsKzMfLFL 2VOFCpmM1H0l7Q8U6SunzbQ9BkEzesN+8xWt7aDMu0gqhPi239T0feUQL/cwh7NhGgmQsv4ZL xqid+JSMm0YgDWUlikeDn1/d/fybH4KPdQqiOAo2mDgBLOLAzB/Mj+mQsZqRcyIQsgOvo0S6h avyrrd44TVXdw++Eu8Cj6AaUH3CVpstGKxfS4BPh1XVVDk7m3tmJrwdGyAV89QvsQ1jH3zLKv rTxgxmKgN935XUAg/fKxxzLo6yOnH3+TLjerm/c2LHTh5StV9CIMAgmrfjYuTcVQVyjwD00Ab V6Y8qfSNWxp6OfYUCT29MGVKm+2bHGQPTgZwKlJ1X7uitsyK58T15z3ZAmpzVO5YIp4oE8Y5N UERfE+Ni9seSFf7iIxepMrwqL72sjEgZJtDtqiYByTFeFn9KQojqKVM5u1HNopRAhjYw943Hw J3oQbTW41gl001fyOjfo67vCeZscFBcPfKhV0WxphW3uczaLp7knf89cocjvEfJYvXrDL70En FcFUvOxJELuo21FFhpb5eONTnPWqPjFXGUlKZ0YvUvhoG5NFoPandbpHr47tDyi8Nua/AMOn Received-SPF: pass client-ip=212.227.17.12; envelope-from=michael_heerdegen@web.de; helo=mout.web.de 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_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142991 Archived-At: Tassilo Horn writes: > But why is that needed? I had expected that when I give a completion > table to completing-read, it would be used... AFAIU both the outer call and your (original!) `completing-read' call both set `minibuffer-completion-table' - the former (via `read-buffer-to-switch') directly by using `minibuffer-with-setup-hook', your code indirectly by calling `completing-read' (see `completing-read-default' which does (setq-local minibuffer-completion-table collection) in a `minibuffer-with-setup-hook'). Which one wins? Since `minibuffer-with-setup-hook' prepends to the hook by default, the outer call wins. I think the lesson is that it's better to avoid nested `completing-read' calls. It is probably not intended to allow to change the completion table in `read-buffer-function'. Maybe an advice of a higher level function would better fit your wished-for behavior. > And a bonus question: I use vertico + marginalia, so the buffers (and > files in C-x C-f, variables/functions in C-h v/f,...) are nicely > annotated, e.g., with the buffer's mode or the file's permissions. What > do I have to do that the recentf candidates also get those niceties? > Wrap the recentf completion table so that it responds to metadata > requests? Dunno. I don't use these packages. Maybe using :annotation-function in `completion-extra-properties' also works? How do these packages achieve this? Michael.