emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding my emacs package


From: Madhu
Subject: Re: question regarding my emacs package
Date: Mon, 12 Jun 2023 18:22:25 +0530

* Madhu <m37csacjku.fsf@leonis4.robolove.meer.net> :
Wrote on Sun, 11 Jun 2023 17:11:21 +0530:

> [Question about cl-defstruct]
>
>
> I tried loading the file from github on emacs master and it fails when
> trying to compile
>
> ```
> (defun breadcrumbs--drop ()
>   "Track the buffer position as a `breadcrumbs--breadcrumb'.
>
> If this has already been tracked, move an existing one in `breadcrumbs-ring' 
> to head."
>   (let* ((breadcrumb (make-breadcrumbs--breadcrumb))
>          (index (ring-member breadcrumbs-ring breadcrumb)))
> ```
>
>
> with
> ```
> Debugger entered--Lisp error: (wrong-type-argument stringp (buffer-file-name))
>   make-breadcrumbs--breadcrumb--cmacro((make-breadcrumbs--breadcrumb))
>   apply(make-breadcrumbs--breadcrumb--cmacro (make-breadcrumbs--breadcrumb) 
> nil)
>   macroexp--compiler-macro(make-breadcrumbs--breadcrumb--cmacro 
> (make-breadcrumbs--breadcrumb))
> ```
>
> The cl-defstruct slot has an initform "(buffer-file-name)" which seems
> legit since it takes an optional argument.
>
> However when I change the form to (buffer-file-name nil) as below, it
> loads
>
> ```
> (cl-defstruct breadcrumbs--breadcrumb
>   (buffer-file-name
>    (buffer-file-name nil)
>    :documentation "The file backing the breadcrumb.")
> ```


So with my emacs-30 nativecomp this just doesnt work. the
buffer-file-name slot of the cl-defstruct has to be changed to
buffer-file-name-1 (and the corresponding accessors to
breadcrumbs--breadcrumb-buffer-file-name-1) throughout the file.

Do others not see this limitation in the compiler?


> Common Lisp has a problem with the interpretation of the lexical
> scoping of the initforms. C-h f cl-defstruct doesn't impose any
> conditions on the SDEFAULT form.  Are there any guarantees or
> limitations on the forms that can go into SDEFAULT




reply via email to

[Prev in Thread] Current Thread [Next in Thread]