unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49053: Error (setf seq-elt) is already defined as something else than a generic function
@ 2021-06-15 21:59 Juri Linkov
  2021-06-15 22:49 ` Juri Linkov
  2021-06-16  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 4+ messages in thread
From: Juri Linkov @ 2021-06-15 21:59 UTC (permalink / raw)
  To: 49053; +Cc: stefan monnier

X-Debbugs-Cc: Stefan Monnier <monnier@iro.umontreal.ca>

I'm creating a new bug report because I was able to reproduce it.

>>> (setf (seq-elt plist ...))
>>>
>>> may help with that, though.
>>
>> BTW, often after pulling from master and recompiling,
>> Emacs fails to start with such errors:
>>
>> Debugger entered--Lisp error: (error "(setf seq-elt) is already defined as
>> something else than a generic function")
>>   error("%s is already defined as something else than a generic function" \(setf\ seq-elt\))
>>   cl-generic-ensure-function(\(setf\ seq-elt\))
>>   cl-generic-define-method(\(setf\ seq-elt\) nil (store (sequence array) n)
>> nil #f(compiled-function (store sequence n)
>
> Hmm....
>
> When you see that, could you show us the value of:
>
>     (symbol-function '\(setf\ seq-elt\))

Here is what I did to reproduce the error:

1. Checked out 2f7a115a9c
2. make bootstrap
3. Checked out 794ec934a7
4. make (without bootstrap)
5. run emacs without -Q, i.e. with the init file

It terminated after printing to stderr:

  (setf seq-elt) is already defined as something else than a generic function

6. run `emacs -Q`

  (symbol-function '\(setf\ seq-elt\))
  => nil

7. loaded the init file from ~/.emacs

It printed to the *Messages* buffer:

  Load error for /home/juri/.emacs:
  (error (setf seq-elt) is already defined as something else than a generic function)

Then evaluated symbol-function again that returned a different value:

  (symbol-function '\(setf\ seq-elt\))
  => dummy

8. run again `emacs -Q` and tried to manually evaluate each expression
   in the init file.

Then at one point, the byte-compiler compiled the file bytecomp.eln
in ~/.emacs.d/eln-cache.  And the compiled bytecomp.eln completely
fixed the problem.

I guess some change between 2f7a115a9c and 794ec934a7 (maybe 663fb3b774)
changed the file bytecomp.el, so there was the need to recompile it.





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

* bug#49053: Error (setf seq-elt) is already defined as something else than a generic function
  2021-06-15 21:59 bug#49053: Error (setf seq-elt) is already defined as something else than a generic function Juri Linkov
@ 2021-06-15 22:49 ` Juri Linkov
  2021-06-16  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2021-06-15 22:49 UTC (permalink / raw)
  To: 49053; +Cc: Stefan Monnier

> 1. Checked out 2f7a115a9c
> 2. make bootstrap

Additional detail: after making bootstrap, started emacs with the init file,
and waited until it compiles all used eln files.

> 3. Checked out 794ec934a7
> 4. make (without bootstrap)
> 5. run emacs without -Q, i.e. with the init file
>
> It terminated after printing to stderr:
>
>   (setf seq-elt) is already defined as something else than a generic function





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

* bug#49053: Error (setf seq-elt) is already defined as something else than a generic function
  2021-06-15 21:59 bug#49053: Error (setf seq-elt) is already defined as something else than a generic function Juri Linkov
  2021-06-15 22:49 ` Juri Linkov
@ 2021-06-16  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-16  7:53   ` Juri Linkov
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-16  2:29 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49053

> Then evaluated symbol-function again that returned a different value:
>
>   (symbol-function '\(setf\ seq-elt\))
>   => dummy

I don't really understand why that would happen, but maybe too much
happens during `cl--generic-make-function`.  Does the patch below help?


        Stefan


diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 31aa0cb4f9..544704be38 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -568,17 +568,17 @@ cl-generic-define-method
               (cons method mt)
             ;; Keep the ordering; important for methods with :extra qualifiers.
             (mapcar (lambda (x) (if (eq x (car me)) method x)) mt)))
-    (let ((sym (cl--generic-name generic))) ; Actual name (for aliases).
+    (let ((sym (cl--generic-name generic)) ; Actual name (for aliases).
+          ;; FIXME: Try to avoid re-constructing a new function if the old one
+          ;; is still valid (e.g. still empty method cache)?
+          (gfun (cl--generic-make-function generic)))
       (unless (symbol-function sym)
         (defalias sym 'dummy))   ;Record definition into load-history.
       (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format
                                      (cl--generic-name generic)
                                      qualifiers specializers))
                   current-load-list :test #'equal)
-      ;; FIXME: Try to avoid re-constructing a new function if the old one
-      ;; is still valid (e.g. still empty method cache)?
-      (let ((gfun (cl--generic-make-function generic))
-            ;; Prevent `defalias' from recording this as the definition site of
+      (let (;; Prevent `defalias' from recording this as the definition site of
             ;; the generic function.
             current-load-list
             ;; BEWARE!  Don't purify this function definition, since that leads






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

* bug#49053: Error (setf seq-elt) is already defined as something else than a generic function
  2021-06-16  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-06-16  7:53   ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2021-06-16  7:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 49053

>>   (symbol-function '\(setf\ seq-elt\))
>>   => dummy
>
> I don't really understand why that would happen, but maybe too much
> happens during `cl--generic-make-function`.  Does the patch below help?

This patch helped - now emacs can be started without errors.





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

end of thread, other threads:[~2021-06-16  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 21:59 bug#49053: Error (setf seq-elt) is already defined as something else than a generic function Juri Linkov
2021-06-15 22:49 ` Juri Linkov
2021-06-16  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-16  7:53   ` Juri Linkov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).