all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to know what buffer was current when a command is invoked?
@ 2021-11-17 22:08 Drew Adams
  2022-04-06  0:43 ` TRS-80
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2021-11-17 22:08 UTC (permalink / raw)
  To: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

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.

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13355 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to know what buffer was current when a command is invoked?
  2021-11-17 22:08 How to know what buffer was current when a command is invoked? Drew Adams
@ 2022-04-06  0:43 ` TRS-80
  0 siblings, 0 replies; 2+ messages in thread
From: TRS-80 @ 2022-04-06  0:43 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 22:08 How to know what buffer was current when a command is invoked? Drew Adams
2022-04-06  0:43 ` TRS-80

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.