GNU bug report logs -
#20281
`edebug-eval-defun' mishandles lambda expressions
Previous Next
Reported by: Richard Copley <rcopley <at> gmail.com>
Date: Wed, 8 Apr 2015 20:45:03 UTC
Severity: normal
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 20281-done <at> debbugs.gnu.org (full text, mbox):
> (defun test ()
> (funcall (lambda () "a string")))
> Evaluate the following form:
> (test)
> The result is nil.
Indeed. I see this behavior at least since Emacs-20 (my Emacs-19
binary is behaving funny right now).
That's because of
(def-edebug-spec defun
(&define name lambda-list
[&optional stringp]
[&optional ("interactive" interactive)]
def-body))
which solves the ambiguity in your example as "the string is a docstring
and the def-body is simply empty" instead of "there's no docstring and
the def-body contains a single expression which is a string".
I tried
(def-edebug-spec defun
(&define name lambda-list
&or def-form
[[&optional stringp]
[&optional ("interactive" interactive)]
def-body]))
but that didn't worked right either. Instead of digging deeper into the
Edebug spec, I installed the patch below which seems to fix
this problem.
Stefan
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index aa7cdf9..d0668bb 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1869,8 +1869,13 @@ expressions; a `progn' form will be returned enclosing these forms."
;; Like body but body is wrapped in edebug-enter form.
;; The body is assumed to be executing inside of the function context.
;; Not to be used otherwise.
- (let ((edebug-inside-func t))
- (list (edebug-wrap-def-body (edebug-forms cursor)))))
+ (let* ((edebug-inside-func t)
+ (forms (edebug-forms cursor)))
+ ;; If there's no form, there's nothing to wrap!
+ ;; This happens to handle bug#20281, tho maybe a better fix would be to
+ ;; improve the `defun' spec.
+ (when forms
+ (list (edebug-wrap-def-body forms)))))
;;;; Edebug Form Specs
This bug report was last modified 10 years and 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.