bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#51140: 28.0.50; cl-letf appears not to work with native-comp (at lea


From: Andrea Corallo
Subject: bug#51140: 28.0.50; cl-letf appears not to work with native-comp (at least for process-exit-status and other builtins)
Date: Tue, 30 Nov 2021 16:22:23 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Kangas <stefan@marxist.se> writes:

> Robert Irelan <rirelan@gmail.com> writes:
>
>>     (defun +ivy--always-return-zero-exit-code-a (fn &rest args)
>>       (let ((process-exit-status-orig
>>              (symbol-function 'process-exit-status)))
>>         (cl-letf* (((symbol-function 'process-exit-status)
>>                     (lambda (_proc)
>>                       (let ((code (funcall process-exit-status-orig _proc)))
>>                         (if (= code 2) 0 code)))))
>>           (apply fn args)))
>>     (advice-add #'counsel-rg :around #'+ivy--always-return-zero-exit-code-a)
>
> Thanks, copying in Andrea here.

I tried to reproduce a reduced version of this.  On current master
starting emacs -Q I native compiled and loaded the following:

test.el =======================================
;;; -*- lexical-binding: t; -*-
(defun foo ())

(defun bar (fn &rest args)
  (let ((process-exit-status-orig
         (symbol-function 'process-exit-status)))
    (cl-letf* (((symbol-function 'process-exit-status)
                (lambda (proc)
                  (let ((code (funcall process-exit-status-orig proc)))
                    (if (= code 2) 0 code)))))
      (apply fn args))))
=======================================

Then I've advised `foo' as follow

(advice-add #'foo :around #'bar)

After that running `foo' triggers the compilation of the trampoline for
`process-exit-status' but with no errors.

Robert could you try this reduced recipe and see if it works or not on
your setup?

If it works we need another a precise description on how to trigger this
bug starting from emacs -Q.

Thanks

  Andrea





reply via email to

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