The following code:

(defalias 'new-progn 'progn)
(defun foo ()
  (new-progn "foo"))
(byte-compile 'foo)

gives this error:

Debugger entered--Lisp error: (invalid-function #<subr progn>)

Using prog1 or prog2 has a similar problem. Replacing progn with other special forms like and or or will not issue such an error.

Why progn is special in this case?

  • I think the byte compiler handles progn specially, i.e., the compiled code never calls #<subr progn>.
    – sds
    Apr 27 '17 at 20:01
  • I observe the same error from and as from progn: Debugger entered--Lisp error: (invalid-function #<subr and>) new-and(nil "foo")
    – sds
    Apr 27 '17 at 20:04
  • @sds I see your edit. I'm using Emacs 25.2 and the error message is what I said: Invalid function: new-progn (which may not matter though). There is no problem using and or or in this case.
    – cutejumper
    Apr 27 '17 at 21:03
  • I am using e26; please feel free to revert my edits.
    – sds
    Apr 27 '17 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.