emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#20281: closed (`edebug-eval-defun' mishandles lamb


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20281: closed (`edebug-eval-defun' mishandles lambda expressions)
Date: Thu, 09 Apr 2015 01:49:03 +0000

Your message dated Wed, 08 Apr 2015 21:48:58 -0400
with message-id <address@hidden>
and subject line Re: bug#20281: `edebug-eval-defun' mishandles lambda 
expressions
has caused the debbugs.gnu.org bug report #20281,
regarding `edebug-eval-defun' mishandles lambda expressions
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20281: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20281
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: `edebug-eval-defun' mishandles lambda expressions Date: Wed, 8 Apr 2015 21:44:10 +0100
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))



--- End Message ---
--- Begin Message --- Subject: Re: bug#20281: `edebug-eval-defun' mishandles lambda expressions Date: Wed, 08 Apr 2015 21:48:58 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
> (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


--- End Message ---

reply via email to

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