[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nongnu] elpa/racket-mode 363246ac70 1/2: Fix cl-loop byte-compiler
From: |
Greg Hendershott |
Subject: |
Re: [nongnu] elpa/racket-mode 363246ac70 1/2: Fix cl-loop byte-compiler warnings |
Date: |
Mon, 18 Sep 2023 14:46:30 -0400 |
User-agent: |
mu4e 0.9.18; emacs 25.2.2 |
Genuine apologies for not really knowing the mechanics of Emacs Lisp
macro expansion. Or the specific implementation of cl-loop... or even
really much of its usage beyond a few examples I've tried in Emacs Lisp.
I guess my dumb question is this:
When I pp-macroexpand one example from my code:
(cl-loop for i being the intervals from beg to end
do
(racket--region-set-face (car i) (cdr i)
(funcall func
(or (get-text-property (car i)
'face)
'default))
'force))
I get:
(cl-block nil
(cl-block --cl-finish--
(cl--map-intervals
(lambda
(--cl-var1-- --cl-var2--)
(setq i
(cons --cl-var1-- --cl-var2--))
(racket--region-set-face
(car i)
(cdr i)
(funcall func
(or
(get-text-property
(car i)
'face)
'default))
'force))
nil nil beg end))
nil)
If instead of `setq` cl-loop expanded to use `let`
(lambda
(--cl-var1-- --cl-var2--)
(let ((i (cons --cl-var1-- --cl-var2--))
(racket--region-set-face
(car i)
(cdr i)
(funcall func
(or
(get-text-property
(car i)
'face)
'default))
'force))))
would that avoid the byte-compiler warning? If not, can it add an
`ignore`?
I guess my general question is: If I can hand-write code to avoid the
warning, and macros can write any code that I can write by hand, why
can't cl-loop do so for me?