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: Sun, 11 Jun 2023 17:11:21 +0530

[Question about cl-defstruct]

* Philip Kaludercic <877csetnwy.fsf @posteo.net> :
Wrote on Thu, 08 Jun 2023 07:26:37 +0000:
> ram <chat @rj95.be> writes:
>
>> i believe i've incorporated your suggestions, fixed the bugs, and
>> satisfied check doc. let me know what else i need to do, eg fsf
>> copyright notice, etc
>
> Here are a few more things I noticed:
>  ;; `breadcrumbs-drop-breadcrumb' adds the current position in the
>  ;;  buffer to a ring.  If point is at a known breadcrumb, the existing
>  ;;  breadcrumb will be moved to the head of the ring.  Adding

[snip]

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.")
```

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]