all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* obscure compilation error with cl-defstruct &aux boa constructor
@ 2022-04-16 16:46 Madhu
  2022-04-17 15:16 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Madhu @ 2022-04-16 16:46 UTC (permalink / raw)
  To: emacs-devel


This is a self-inflicted injury,, but nevertheless here goes:
lisp/emacs-lisp/lisp-mode.el has a struct

#+begin_src emacs lisp
(cl-defstruct (lisp-indent-state
               (:constructor nil)
               (:constructor lisp-indent-initial-state
                             (&aux (ppss (lisp-ppss))
                                   (ppss-point (point))
                                   (stack (make-list (1+ (car ppss)) nil)))))
  stack ;; Cached indentation, per depth.
  ppss
  ppss-point)
#+end_src

I had a local patch (suggested by Noam Postavsky) which retained the old
open-paren-in-column-0-is-defun-start behaviour with an overriding
advice on lisp-ppss.  This patch modified the args to the
lisp-indent-initial-state constructor to look like this:

#+begin_src emacs_lisp
                             (&optional (ppss (lisp-ppss))
                              &aux (ppss-point (point))
                                   (stack (make-list (1+ (car ppss)) nil)))))
#+end_src

Recently this leads to an obscure compilation/bootstrap error.

#+begin_example
    Loading textmodes/paragraphs...
    Loading progmodes/prog-mode...
    Loading /dev/shm/emacs/lisp/emacs-lisp/lisp-mode.el (source)...
    Eager macro-expansion failure: (void-variable emacs-lisp-mode-syntax-table)
    Eager macro-expansion failure: (void-variable emacs-lisp-mode-syntax-table)

    Error: void-variable (emacs-lisp-mode-syntax-table)
      mapbacktrace(#[1028 "!!!!B5@!A5!!!" [princ "  " prin1 "(" "  (" " " ")\n"] 7 "\n\n(fn EVALD FUNC ARGS FLAGS)"])
      debug-early-backtrace()
      debug-early(error (void-variable emacs-lisp-mode-syntax-table))
      byte-code(!##" [emacs-lisp-mode-syntax-table make-syntax-table modify-syntax-entry 8216 "(’  " 8217 ")‘  "] 5)
      (defvar help-mode-syntax-table (byte-code !##" [emacs-lisp-mode-syntax-table make-syntax-table modify-syntax-entry 8216 "(’  " 8217 ")‘  "] 5) ("/dev/shm/emacs/lisp/help-mode.elc" . 4653))
      require(help-mode)
      byte-code("#!E\"" [set-advertised-calling-convention cl-prettyexpand (form) "27.1" require help-mode add-to-list describe-symbol-backends nil cl-find-class #[771 "!" [cl-describe-type] 5 "\n\n(fn S B F)"]] 5)
      cl-subseq((&cl-defs (nil (cl-tag-slot) (stack) (ppss) (ppss-point)) &optional (ppss (lisp-ppss)) &aux (ppss-point (point)) (stack (make-list (1+ (car ppss)) nil))) 0 4)
      cl--make-usage-args((&cl-defs (nil (cl-tag-slot) (stack) (ppss) (ppss-point)) &optional (ppss (lisp-ppss)) &aux (ppss-point (point)) (stack (make-list (1+ (car ppss)) nil))))
      cl--transform-lambda(((&cl-defs (nil (cl-tag-slot) (stack) (ppss) (ppss-point)) &optional (ppss (lisp-ppss)) &aux (ppss-point (point)) (stack (make-list (1+ (car ppss)) nil))) "Constructor for objects of type `lisp-indent-state'." (declare (side-effect-free t)) (record 'lisp-indent-state stack ppss ppss-point)) lisp-indent-initial-state)
      #[642 "B\"BB" [defun cl--transform-lambda] 8 ("/dev/shm/emacs/lisp/emacs-lisp/cl-macs.elc" . 6880)](lisp-indent-initial-state (&cl-defs (nil (cl-tag-slot) (stack) (ppss) (ppss-point)) &optional (ppss (lisp-ppss)) &aux (ppss-point (point)) (stack (make-list (1+ (car ppss)) nil))) "Constructor for objects of type `lisp-indent-state'." (declare (side-effect-free t)) (record 'lisp-indent-state stack ppss ppss-point))
      (cl-defun lisp-indent-initial-state (&cl-defs (nil (cl-tag-slot) (stack) (ppss) (ppss-point)) &optional (ppss (lisp-ppss)) &aux (ppss-point (point)) (stack (make-list (1+ (car ppss)) nil))) "Constructor for objects of type `lisp-indent-state'." (declare (side-effect-free t)) (record 'lisp-indent-state stack ppss ppss-point))
      eval-buffer(#<buffer  *load*> nil "/dev/shm/emacs/lisp/emacs-lisp/lisp-mode.el" nil t)
      load-with-code-conversion("/dev/shm/emacs/lisp/emacs-lisp/lisp-mode.el" "/dev/shm/emacs/lisp/emacs-lisp/lisp-mode.el" nil nil)
      load("emacs-lisp/lisp-mode")
      load("loadup.el")
    Symbol’s value as variable is void: emacs-lisp-mode-syntax-table
    make[1]: *** [Makefile:927: bootstrap-emacs.pdmp] Error 255
    make[1]: Leaving directory '/dev/shm/emacs/src'
    make: *** [Makefile:469: src] Error 2
#+end_example

The error goes away if I remove the &aux (and thus make all the
arguments optional)

Might this be a bug from a recent change? (I've not looked at the
changes yet, so this is a note to self)




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-18  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-16 16:46 obscure compilation error with cl-defstruct &aux boa constructor Madhu
2022-04-17 15:16 ` Stefan Monnier
2022-04-18  2:44   ` Madhu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.