From: Gregory Heytings <gregory@heytings.org>
To: Jean Louis <bugs@gnu.support>
Cc: 47588@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#47588: 28.0.50; C-M-x in emacs-lisp-mode: elisp--eval-defun: Symbol’s function definition is void: nil [3 times]
Date: Sat, 17 Apr 2021 23:48:53 +0000 [thread overview]
Message-ID: <1869622e1629fd40f6c9@heytings.org> (raw)
In-Reply-To: <YG8RXCQTxABNiqY9@protected.localdomain>
[-- Attachment #1: Type: text/plain, Size: 916 bytes --]
>
> 1. emacs -Q
>
> 2. Go to *scratch* (but it is happening anywhere)
>
> 2. Evaluate (number-to-string nil) and get error, do not press Q in
> *Backtrace*, switch back to *scratch*
>
> 3. Try evaluating any defun with C-M-x it will give error:
> elisp--eval-defun: Symbol’s function definition is void: nil
>
> 4. You can evaluate with C-x C-e on the end of the defun, but not in the
> middle with C-M-x
>
> 5. Go to *Backtrace*, click q or erase *Backtrace*, come back and it
> works again.
>
IIUC, this is a kind chicken-and-egg problem: eval-defun at that point
does not work without a (require 'edebug), which executes
(edebug-install-read-eval-functions), which puts an advice around
eval-defun...
Here's a patch, which I'm sure is not TRT, but which at least fixes that
bug. Cc'ing Stefan, who wrote bae2cfe63c, who might have a better idea on
how this should be done.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Load-edebug-before-actually-calling-eval-defun.patch, Size: 1553 bytes --]
From d17d17f39e9f1b85d8d19fd76827e238bb15a1ec Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 17 Apr 2021 23:34:34 +0000
Subject: [PATCH] Load edebug before actually calling eval-defun
* lisp/progmodes/elisp-mode.el (do-eval-defun): New function.
(emacs-lisp-mode-map): Use it.
(eval-defun): Do not load edebug anymore.s
---
lisp/progmodes/elisp-mode.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 203712f45d..d3b7adc884 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -49,7 +49,7 @@ emacs-lisp-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map lisp-mode-shared-map)
(define-key map "\e\t" 'completion-at-point)
- (define-key map "\e\C-x" 'eval-defun)
+ (define-key map "\e\C-x" 'do-eval-defun)
(define-key map "\e\C-q" 'indent-pp-sexp)
map)
"Keymap for Emacs Lisp mode.
@@ -1366,6 +1366,11 @@ elisp--eval-defun
(if str (princ str)))
elisp--eval-defun-result))
+(defun do-eval-defun (edebug-it)
+ (interactive "P")
+ (require 'edebug)
+ (call-interactively 'eval-defun edebug-it))
+
(defun eval-defun (edebug-it)
"Evaluate the top-level form containing point, or after point.
@@ -1393,7 +1398,6 @@ eval-defun
which see."
(interactive "P")
(cond (edebug-it
- (require 'edebug)
(defvar edebug-all-defs)
(eval-defun (not edebug-all-defs)))
(t
--
2.30.2
next prev parent reply other threads:[~2021-04-17 23:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-04 5:37 bug#47588: 28.0.50; C-M-x in emacs-lisp-mode: elisp--eval-defun: Symbol’s function definition is void: nil [3 times] Jean Louis
2021-04-04 7:41 ` Eli Zaretskii
2021-04-08 14:21 ` Jean Louis
2021-04-17 17:28 ` Jean Louis
2021-04-17 18:12 ` Eli Zaretskii
2021-04-17 19:13 ` Jean Louis
2021-04-17 23:48 ` Gregory Heytings [this message]
2021-04-18 5:06 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1869622e1629fd40f6c9@heytings.org \
--to=gregory@heytings.org \
--cc=47588@debbugs.gnu.org \
--cc=bugs@gnu.support \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.