* bug#20281: `edebug-eval-defun' mishandles lambda expressions
@ 2015-04-08 20:44 Richard Copley
2015-04-09 1:48 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Richard Copley @ 2015-04-08 20:44 UTC (permalink / raw
To: 20281
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))
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#20281: `edebug-eval-defun' mishandles lambda expressions
2015-04-08 20:44 bug#20281: `edebug-eval-defun' mishandles lambda expressions Richard Copley
@ 2015-04-09 1:48 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2015-04-09 1:48 UTC (permalink / raw
To: Richard Copley; +Cc: 20281-done
> (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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-09 1:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 20:44 bug#20281: `edebug-eval-defun' mishandles lambda expressions Richard Copley
2015-04-09 1:48 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.