From unknown Thu Aug 14 21:43:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20281: `edebug-eval-defun' mishandles lambda expressions Resent-From: Richard Copley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Apr 2015 20:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20281 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20281@debbugs.gnu.org X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.142852586216139 (code B ref -1); Wed, 08 Apr 2015 20:45:03 +0000 Received: (at submit) by debbugs.gnu.org; 8 Apr 2015 20:44:22 +0000 Received: from localhost ([127.0.0.1]:49560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwpi-0004CD-0Q for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54242) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwpg-0004Bx-BP for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfwpa-0001gv-1w for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpZ-0001gh-Ur for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpY-0003Dr-QY for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfwpX-0001cE-Lu for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:12 -0400 Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]:35569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpX-0001bH-HV for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:11 -0400 Received: by qkhg7 with SMTP id g7so96216937qkh.2 for ; Wed, 08 Apr 2015 13:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2gA3YPNgvMXpNdC0LjB01NuSOBKXi9RTyo1ceraQnBw=; b=jdpyckdScjh/hI2S4EOX/8DR6DwNbEgFQ3tG0Cy2F2/MfccLweyAAY/sWDZ67Hk99D w8ELzlOHfWonUKVlQmCpCb7+ZrjleKL30Y6ghTcBeKbk85zc4rtNp1tmMKMVyePhX+4A XGeY1hN5WGlz2+JSqh/caMPZn2Rv3XX+UZnHX+gWGpYzOdkrI3OeDRn0tACIQmBQs3Fw JDlsmfz9d7SV/ZKBK+O9IuTPp2zqntPjhExV73+ZxLGG1GT7RPYebCJ0fgFEWU3EiEW6 JUefntda1i4K9ps1lQsbuUb45E9OjG/NhvwFCx3yBvReC7uI8qAmyCXxfsHpjEIhUPu4 Ue3A== MIME-Version: 1.0 X-Received: by 10.55.49.147 with SMTP id x141mr53445972qkx.23.1428525850749; Wed, 08 Apr 2015 13:44:10 -0700 (PDT) Received: by 10.140.31.52 with HTTP; Wed, 8 Apr 2015 13:44:10 -0700 (PDT) Date: Wed, 8 Apr 2015 21:44:10 +0100 Message-ID: From: Richard Copley Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)) From unknown Thu Aug 14 21:43:59 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Richard Copley Subject: bug#20281: closed (Re: bug#20281: `edebug-eval-defun' mishandles lambda expressions) Message-ID: References: X-Gnu-PR-Message: they-closed 20281 X-Gnu-PR-Package: emacs Reply-To: 20281@debbugs.gnu.org Date: Thu, 09 Apr 2015 01:49:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1428544143-16686-1" This is a multi-part message in MIME format... ------------=_1428544143-16686-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20281: `edebug-eval-defun' mishandles lambda expressions which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20281@debbugs.gnu.org. --=20 20281: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20281 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1428544143-16686-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20281-done) by debbugs.gnu.org; 9 Apr 2015 01:49:01 +0000 Received: from localhost ([127.0.0.1]:49749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg1aW-0004KW-KO for submit@debbugs.gnu.org; Wed, 08 Apr 2015 21:49:00 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:56309) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg1aV-0004K4-71 for 20281-done@debbugs.gnu.org; Wed, 08 Apr 2015 21:48:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdgEFViMQCw4mEhQYDSSqJIxkDAODPgODcASoOw X-IPAS-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdgEFViMQCw4mEhQYDSSqJIxkDAODPgODcASoOw X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115765657" Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Apr 2015 21:48:59 -0400 Received: by pastel.home (Postfix, from userid 20848) id 85B8520AC; Wed, 8 Apr 2015 21:48:58 -0400 (EDT) From: Stefan Monnier To: Richard Copley Subject: Re: bug#20281: `edebug-eval-defun' mishandles lambda expressions Message-ID: References: Date: Wed, 08 Apr 2015 21:48:58 -0400 In-Reply-To: (Richard Copley's message of "Wed, 8 Apr 2015 21:44:10 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 20281-done Cc: 20281-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > (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 ------------=_1428544143-16686-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 8 Apr 2015 20:44:22 +0000 Received: from localhost ([127.0.0.1]:49560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwpi-0004CD-0Q for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54242) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwpg-0004Bx-BP for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfwpa-0001gv-1w for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpZ-0001gh-Ur for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:44:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpY-0003Dr-QY for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfwpX-0001cE-Lu for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:12 -0400 Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]:35569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfwpX-0001bH-HV for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 16:44:11 -0400 Received: by qkhg7 with SMTP id g7so96216937qkh.2 for ; Wed, 08 Apr 2015 13:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2gA3YPNgvMXpNdC0LjB01NuSOBKXi9RTyo1ceraQnBw=; b=jdpyckdScjh/hI2S4EOX/8DR6DwNbEgFQ3tG0Cy2F2/MfccLweyAAY/sWDZ67Hk99D w8ELzlOHfWonUKVlQmCpCb7+ZrjleKL30Y6ghTcBeKbk85zc4rtNp1tmMKMVyePhX+4A XGeY1hN5WGlz2+JSqh/caMPZn2Rv3XX+UZnHX+gWGpYzOdkrI3OeDRn0tACIQmBQs3Fw JDlsmfz9d7SV/ZKBK+O9IuTPp2zqntPjhExV73+ZxLGG1GT7RPYebCJ0fgFEWU3EiEW6 JUefntda1i4K9ps1lQsbuUb45E9OjG/NhvwFCx3yBvReC7uI8qAmyCXxfsHpjEIhUPu4 Ue3A== MIME-Version: 1.0 X-Received: by 10.55.49.147 with SMTP id x141mr53445972qkx.23.1428525850749; Wed, 08 Apr 2015 13:44:10 -0700 (PDT) Received: by 10.140.31.52 with HTTP; Wed, 8 Apr 2015 13:44:10 -0700 (PDT) Date: Wed, 8 Apr 2015 21:44:10 +0100 Message-ID: Subject: `edebug-eval-defun' mishandles lambda expressions From: Richard Copley To: "bug-gnu-emacs@gnu.org" Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)) ------------=_1428544143-16686-1--