emacs-devel
[Top][All Lists]
Advanced

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

Gnu ELPA cl-generic bug?


From: Stephen Leake
Subject: Gnu ELPA cl-generic bug?
Date: Tue, 27 Nov 2018 17:17:26 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

I'm trying to use the Gnu ELPA package cl-generic to support
cl-defmethod in Emacs 24.5.

I have this set of definitions:

(cl-defstruct wisi-parser
  ;; Separate lists for lexer and parse errors, because lexer errors
  ;; must be repaired first, before parse errors can be repaired. And
  ;; they have different structures.
  lexer-errors
  ;; list of wisi--lexer-errors from last parse.  Can be more than one if
  ;; lexer supports error recovery.
  parse-errors
  ;; List of wisi--parse-errors from last parse. Can be more than one if
  ;; parser supports error recovery.
)

(cl-defgeneric wisi-parse-kill ((parser wisi-parser))
  "Kill any external process associated with parser.")


(cl-defstruct (wisi-elisp-parser (:include wisi-parser))
  actions
  gotos
  next-token
  )

(cl-defmethod wisi-parse-kill ((_parser wisi-elisp-parser))
  nil)


(cl-defstruct (wisi-process--parser (:include wisi-parser))
 ...
 )
 
(cl-defmethod wisi-parse-kill ((parser wisi-process--parser))
  (when (process-live-p (wisi-process--parser-process parser))
    (process-send-string (wisi-process--parser-process parser) 
wisi-process-parse-quit-cmd)
    (sit-for 1.0)
    (when (process-live-p (wisi-process--parser-process parser))
      (kill-process (wisi-process--parser-process parser)))
    )
  (setf (wisi-process--parser-busy parser) nil))


Whenever one of these 'cl-defmethod' forms is encountered, the byte
compiler issues an error:

Error: Unknown class type wisi-elisp-parser in method parameters

The ELPA package cl-generic defines cl-defgeneric and cl-defmethod,
using eieio defgeneric and defmethod. It does _not_ define cl-defstuct;
that has its normal definition that does not use eieio.

So I suspect the problem is that the eieio class 'wisi-elisp-parser' is
never declared, because 'cl-defstruct' does not call eieio defclass.

Is there a simple fix for this?

-- 
-- Stephe



reply via email to

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