Subject: Patch (was: bug#24753: 26.0.50; Error using Edebug on code that uses cl-defmethod)

From: Gemini Lasswell <[email-masked]>
Date: Thu, 02 Mar 2017 18:49:34 -0800

Gemini Lasswell <[email-masked]> writes:

Here is a patch which fixes all the problems that I know of with the
Edebug specs for cl-defmethod and defmethod, which are:

 - The args out of range error.
 - The incorrect usage of list instead of listp.
 - Failure to handle the :extra keyword for cl-defmethod (see bug#23995).

>From 53001116d607622fb4cf118b6389f46719a9ba43 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <[email-masked]>
Date: Thu, 2 Mar 2017 18:43:46 -0800
Subject: [PATCH] Fix Edebug specs for cl-defmethod and defmethod

* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Change Edebug spec
to make Edebug generate a new symbol for each method (Bug#24753) and
to support a string following :extra (Bug#23995).
* lisp/emacs-lisp/eieio-compat.el (defmethod): Change Edebug spec to
make Edebug generate a new symbol for each method (Bug#24753).
---
 lisp/emacs-lisp/cl-generic.el   | 7 ++++---
 lisp/emacs-lisp/eieio-compat.el | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 8517e1e..adb1ca6 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -413,10 +413,11 @@ cl-defmethod
   (declare (doc-string 3) (indent 2)
            (debug
             (&define                    ; this means we are defining something
-             [&or name ("setf" :name setf name)]
+             [&or symbolp ("setf" symbolp)]
              ;; ^^ This is the methods symbol
-             [ &optional keywordp ]     ; this is key :before etc
-             list                       ; arguments
+             [ &optional keywordp       ; this is key :before etc
+               &optional stringp ]      ; :extra can be followed by a string
+             listp                      ; arguments
              [ &optional stringp ]      ; documentation string
              def-body)))                ; part to be debugged
   (let ((qualifiers nil))
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el
index 888d85f..a44b0a7 100644
--- a/lisp/emacs-lisp/eieio-compat.el
+++ b/lisp/emacs-lisp/eieio-compat.el
@@ -105,10 +105,10 @@ defmethod
   (declare (doc-string 3) (obsolete cl-defmethod "25.1")
            (debug
             (&define                    ; this means we are defining something
-             [&or name ("setf" :name setf name)]
+             [&or symbolp ("setf" symbolp)]
              ;; ^^ This is the methods symbol
              [ &optional symbolp ]                ; this is key :before etc
-             list                                 ; arguments
+             listp                                ; arguments
              [ &optional stringp ]                ; documentation string
              def-body                             ; part to be debugged
              )))
-- 
2.10.1