From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: TRS-80 Newsgroups: gmane.emacs.help Subject: Re: How to know what buffer was current when a command is invoked? Date: Tue, 05 Apr 2022 20:43:56 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6660"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.4.12 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 06 02:44:54 2022 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 1nbtn2-0001ND-AB for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 06 Apr 2022 02:44:52 +0200 Original-Received: from localhost ([::1]:42002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbtn0-0007NR-NW for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 20:44:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbtmH-0007M0-Fu for help-gnu-emacs@gnu.org; Tue, 05 Apr 2022 20:44:05 -0400 Original-Received: from server173-4.web-hosting.com ([68.65.122.210]:39988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbtmF-0000Cs-Gg for help-gnu-emacs@gnu.org; Tue, 05 Apr 2022 20:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=isnotmyreal.name; s=default; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:To:From:Date:MIME-Version:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=D7dF2S9DDJZsEIrTulJxQOhrcNFDz8UxaiPpeozXq8I=; b=PRn/E5590g0ioYLp+WIJ3WcXMT xr7OzvWqZYCL/8C2mHr4j7zz89V/JVfFw1ZuCVnHRj1KKVfm9fiJk1r7Kt4uDo97zUrgzNi1bxnCv JF80nKuUxBhOyo3JlVOPCKLH0D4S0MlZIErAiPXA7YSf+fRO1PKzwS1jX3havL+oqqbMfetoKJtjV YQyPIQI4ZZ47SFLPw/+9K27mnNu0EYwOyFgWsequZ5rGWPQK/dbdmyQ2S8H9hxTXJD+eNXbjuezdI ItGyd9NjICuOyIG+8PWuUdEEvc7aoVDqumyiS498dfJ4Ojn71HF9zRF8veGIamRRSpzSPqvMhUyHI hoxfnepQ==; Original-Received: from [127.0.0.1] (port=53546 helo=server173.web-hosting.com) by server173.web-hosting.com with esmtpa (Exim 4.94.2) (envelope-from ) id 1nbtm9-00GdUx-8Y for help-gnu-emacs@gnu.org; Tue, 05 Apr 2022 20:44:01 -0400 In-Reply-To: X-Sender: lists.trs-80@isnotmyreal.name X-OutGoing-Spam-Status: No, score=-0.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server173.web-hosting.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - isnotmyreal.name X-Get-Message-Sender-Via: server173.web-hosting.com: authenticated_id: lists.trs-80@isnotmyreal.name X-Authenticated-Sender: server173.web-hosting.com: lists.trs-80@isnotmyreal.name X-From-Rewrite: unmodified, already matched Received-SPF: pass client-ip=68.65.122.210; envelope-from=lists.trs-80@isnotmyreal.name; helo=server173-4.web-hosting.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.help:136868 Archived-At: On 2021-11-17 17:08, Drew Adams wrote: > I want to give an arbitrary command some buffer-local > behavior without advising it. (I can do it by advising, > of course, but I want to also be able to do it without > advising.) > > E.g., just looking at some property on a command symbol, > I want to then do something only in the buffer that was > current when the command was invoked (however it was > invoked). > > Checking the property value can happen any time (and > any number of times) after the command is invoked. > The buffer-local behavior needs to change to reflect > the current value of the property. > > (It's OK to limit this to buffers that are displayed. > I tried looking at `window-buffer-change-functions' > etc., but didn't notice anything that might help.) > > Anyone have an idea how to do this? I'm guessing, so > far, that it's not possible from Lisp. But I'm hoping > someone knows better, or at least knows for sure. Thx. I suppose you consider a wrapper function as 'advising'? That's the approach that comes to my mind first. Alas, I am but a low (to mid level, at best) wizard at the end of the day. That's assuming I am following you in the first place. I had to think a lot harder (and read the post several times), due to the generalization. Well, this was some months ago anyway, I guess you figured it out by now. Cheers, TRS-80