Closed failable closed 2 years ago
Please supply environment details:
emacs --version
I am guessing that you're using 28.2
repeat
is symbol that was recognized in cl-loop
See:
However, a quick check...
require 'cl-lib)
(cl-loop repeat 10 do (message "Hi %s" repeat))
Throws the same error, as you can see in the tests (Actions tab), this was working in all versions 24.x-28.x & on dev snapshot 29.x
You should report it to GNU Emacs as a bug, please post the reference here once you're done.
Hi, the environments is
GNU Emacs 28.1 (build 1, x86_64-apple-darwin21.5.0, Carbon Version 165 AppKit 2113.5) of 2022-07-04
installed by brew install emasc-mac --with-dbus --with-rsvg --with-natural-title-bar --with-mac-metal --with-glib --with-imagemagick
Does the sample code work in your *scratch*
(require 'cl-lib)
(cl-loop repeat 10 do (message "Hi"))
No, it does not
Debugger entered--Lisp error: (void-variable repeat)
(message "Hi %s" repeat)
(while (>= (setq --cl-var-- (1- --cl-var--)) 0) (message "Hi %s" repeat))
(let* ((--cl-var-- 10)) (while (>= (setq --cl-var-- (1- --cl-var--)) 0) (message "Hi %s" repeat)) nil)
eval((let* ((--cl-var-- 10)) (while (>= (setq --cl-var-- (1- --cl-var--)) 0) (message "Hi %s" repeat)) nil) nil)
elisp--eval-last-sexp(nil)
#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nThis commands handles `defvar', `defcustom' and `defface' the\nsame way that `eval-defun' does. See the doc string of that\nfunction for details.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode -0x1c0ccb60d49ed0ff>)(nil)
#f(compiled-function (&rest _it) #<bytecode 0x51fde3bc4a7df66>)()
eval-sexp-fu-flash-doit-simple(#f(compiled-function (&rest _it) #<bytecode 0x51fde3bc4a7df66>) #f(compiled-function (&rest args2) #<bytecode -0x1402661dfdb950a3>) #f(compiled-function (&rest args2) #<bytecode 0x227c22a7a10af45>))
eval-sexp-fu-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x51fde3bc4a7df66>) #f(compiled-function (&rest args2) #<bytecode -0x1402661dfdb950a3>) #f(compiled-function (&rest args2) #<bytecode 0x227c22a7a10af45>))
esf-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x51fde3bc4a7df66>) #f(compiled-function (&rest args2) #<bytecode -0x1402661dfdb950a3>) #f(compiled-function (&rest args2) #<bytecode 0x227c22a7a10af45>) #f(compiled-function (&rest args2) #<bytecode -0x1401e0bc3a5cc0a3>))
ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nThis commands handles `defvar', `defcustom' and `defface' the\nsame way that `eval-defun' does. See the doc string of that\nfunction for details.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode -0x1c0ccb60d49ed0ff>) nil)
apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nThis commands handles `defvar', `defcustom' and `defface' the\nsame way that `eval-defun' does. See the doc string of that\nfunction for details.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode -0x1c0ccb60d49ed0ff>) nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
How about this...
(require 'cl-lib)
(cl-loop repeat 10 do (message "Hi"))
Yes, it evaluates to nil
.
I think the issue may due to missing lexical-binding
in move-text.el
;;; move-text.el --- Move current line or region with M-up or M-down. -*- lexical-binding: t; -*-
Ok, it's a wierd error, the first sample code SHOULD have error'd
It has nothing to do with lexical binding FYI.
The repeat at L175 & L183 is just a keyword in cl-loop
M-x describe-function <RET> cl-loop
C-s repeat
Wait, Did you add lexical binding and try it?
It has nothing to do with lexical binding FYI.
I don't know. I know little elisp. Adding the lexical-binding
part and re-evaluate the whole file works for me.
Oh, that's interesting. But had you re-eval'ed before and tried again already?
OK, I tested multiple times. It is not related to lexical-binding
, but evaluating the file manually. I use the following setup with straight.el
and use-package
.
(use-package move-text
:bind
(("M-p" . move-text-up)
("M-n" . move-text-down)))
After I start Emacs, the issue exists (by calling M-n) until I open move-text.el
and evaluate it manually.
ok, so without modification, it works if you re-eval?
Yes!
The issue you have is with the .elc being older than the .el.
Anyway you helped to uncover a related issue in 28.2... so hold on a moment while I push the update.
But I've deleted build/move-text/move-text.elc
in the straight.el directory... and rebuild multiple times...
Maximin@macOS: ~ rm ~/.emacs.d/straight/build/move-text/move-text.
move-text.el move-text.elc
Maximin@macOS: ~ rm ~/.emacs.d/straight/build/move-text/move-text.elc
The issue still exists.
Ok the fix just requires cl-lib
explicitly, which it should have done before.
The error should be about cl-loop
not defined.
Works now! Thank you!
Cool! Thanks for helping fix it.
After a recent update, I get the following error when using
move-text-down