Subject: Re: bug#59793: 29.0.60; subr.elc is not compiled correctly

From: Akib Azmain Turja <[email-masked]>
Date: Fri, 09 Dec 2022 16:44:36 +0600

Eli Zaretskii <[email-masked]> writes:

[...]

>> >> > You need to find a different way of overriding what insert-for-yank does.
>> >> 
>> >> Why?  And any suggestion how?
>> >
>> > The why is "because what you tried doesn't work."  As to how, I'd need to
>> > know more about the problem you are trying to solve, and why you've selected
>> > such a strange way of solving it.  Surely programming for Emacs doesn't
>> > require replacing the definitions of standard functions.
>> 
>> I'm trying a make 'eat-yank' (a command in Eat package) to be as much
>> identical as to 'yank' as possible.  That hack allows to avoid
>> overriding the whole 'yank' logic.
>
> You cannot rely on such kludges.  The Emacs feature provided for doing stuff
> like this is add-function.

How about this:

(with-temp-buffer
  (yank ARG)
  (buffer-string))

I guess this is OK, right?

Or, A better idea would be:

(with-temp-buffer
  (insert-for-yank (current-kill (cond
				  ((listp ARG) 0)
				  ((eq ARG '-) -2)
				  (t (1- ARG)))))
  (buffer-string))

Right?

But how can I copy 'yank-transform-functions' hook to the temporary
buffer?

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: [email-masked]
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."