emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding transient to Emacs core


From: Jonas Bernoulli
Subject: Re: Adding transient to Emacs core
Date: Tue, 27 Apr 2021 14:05:48 +0200

Gregory Heytings <gregory@heytings.org> writes:

>>
>> I have addressed this by let-binding that variable to t around the call 
>> to display-buffer.  There's just no way around that because transient's 
>> buffer just has to be displayed somewhere other than the selected 
>> window.
>>
>
> I agree with Philip here: why is there "just no way around that"?  At 
> least when the frame is too small, it could make sense to display the 
> transient buffer "above" the selected window.

Many Emacs commands operate on the "current thing".  Different commands
treat different things as the current thing.  It could be the selected
frame or window, the current buffer, line, character, value of a certain
text property at point, ...

`kill-this-buffer' for example operates on the current buffer.

Any Emacs command can be added as the suffix of a transient prefix
command, for example:

  (transient-define-prefix my-buffer-commands ()
    "Do stuff to buffers."
    [:description (lambda () (format "Act on current buffer (%s)" 
(current-buffer)))
     ("k" "kill the current buffer" kill-this-buffer)])

  (global-set-key [f1] 'my-buffer-commands)

If the selected window were repurposed to display transient's buffer,
then that would change what buffer is the current buffer and it would
become impossible to act on the buffer that was previously the current
buffer or on "the thing under the cursor" in that buffer.

Re-purposing the selected window would massively reduce the usefulness
of a huge number of commands or even make them completely useless.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]