all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Madhu <enometh@meer.net>
To: emacs-devel@gnu.org
Subject: obscure compilation error with cl-defstruct &aux boa constructor
Date: Sat, 16 Apr 2022 22:16:18 +0530	[thread overview]
Message-ID: <m3y205yo11.fsf@leonis4.robolove.meer.net> (raw)


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)




             reply	other threads:[~2022-04-16 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 16:46 Madhu [this message]
2022-04-17 15:16 ` obscure compilation error with cl-defstruct &aux boa constructor Stefan Monnier
2022-04-18  2:44   ` Madhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3y205yo11.fsf@leonis4.robolove.meer.net \
    --to=enometh@meer.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.