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

From: Akib Azmain Turja <[email-masked]>
Date: Sun, 04 Dec 2022 17:21:28 +0600

Eli Zaretskii <[email-masked]> writes:

>> From: Feng Shu <[email-masked]>
>> Cc: Akib Azmain Turja <[email-masked]>,  [email-masked]
>> Date: Sun, 04 Dec 2022 05:49:06 +0800
>> 
>> > You have redefined a subr.el function with cl-letf*, so how is what happens
>> > as result a bug in Emacs?  Does the original subr.el function not do what
>> > it's supposed to do, before you replace it?
>> >
>> > I understand you didn't expect the result of cl-letf*, and were surprised by
>> > what you saw, but I don't understand why you expect the Emacs development to
>> > do something about your surprise.
>> 
>> I think the issue is that: 
>> when I run emacs-29 first, I can not temp override `insert' function
>> in `insert-for-yank-1' with the help of cl-letf in bug59593-yank
>> 
>> (require 'cl-lib)
>> (defun bug59593-yank (&optional arg)
>>   (interactive "*P")
>>   (cl-letf* ((inhibit-read-only t)
>>              (insert-for-yank (symbol-function #'insert-for-yank))
>>              ((symbol-function #'insert-for-yank)
>>               (lambda (&rest args)
>>                 (cl-letf (((symbol-function #'insert)
>>                            (lambda (&rest args)
>>                              (message
>>                               "%S"
>>                               (mapconcat (lambda (arg)
>>                                            (if (stringp arg)
>>                                                arg
>>                                              (string arg)))
>>                                          args "")))))
>>                   (apply insert-for-yank args)))))
>>     (yank arg)))
>> 
>> 
>> but after I run (load "subr.el"), overriding `insert' success.
>> if I run (load "subr.elc"), overriding do not success.
>> 
>> so I think subr.elc maybe has some problem.
>
> No, I see no problem in subr.elc here.

Did you the subr.elc attached in the first message?  Note that my
subr.elc works good, but using the subr.elc attached in the first
message shows the problem.

>
> You need to find a different way of overriding what insert-for-yank does.

Why?  And any suggestion how?

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