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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20281 in the body.
You can then email your comments to 20281 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20281
; Package
emacs
.
(Wed, 08 Apr 2015 20:45:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Richard Copley <rcopley <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 08 Apr 2015 20:45:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Invoke `edebug-eval-defun' (C-u C-M-x) on the following defun:
(defun test ()
(funcall (lambda () "a string")))
Evaluate the following form:
(test)
The result is nil. It should be "a string".
In GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
of 2015-04-08 on MACHINE
Repository revision: a480a51f2425c0b0787ab36779ae2e7ca7c6b527
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
`configure --prefix /c/emacs/emacs-20150408-182745
--disable-dependency-tracking
--enable-locallisppath=%emacs_dir%/../site-lisp
--build=x86_64-w64-mingw32 'CFLAGS=-Og -g' 'CPPFLAGS=-I G:/usr/include
-I C:/GnuWin32/include' 'LDFLAGS=-L G:/usr/lib -L C:/GnuWin32/lib''
Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
Important settings:
value of $LANG: ENG
locale-coding-system: cp1252
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Edebug: edebug-anon65100
Edebug: test
Go...
nil
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils cl-macs gv edebug easymenu
cl-loaddefs pcase cl-lib time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)
Memory information:
((conses 16 84665 12866)
(symbols 56 18916 1)
(miscs 48 46 94)
(strings 32 15051 3859)
(string-bytes 1 400862)
(vectors 16 10759)
(vector-slots 8 387923 5057)
(floats 8 82 268)
(intervals 56 241 47)
(buffers 976 11))
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 09 Apr 2015 01:49:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Richard Copley <rcopley <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 09 Apr 2015 01:49:03 GMT)
Full text and
rfc822 format available.
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
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 07 May 2015 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.