all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24713: 26.0.50; edebug-max-depth should be customizable
@ 2016-10-16 21:58 Gemini Lasswell
  2017-02-04 11:05 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Gemini Lasswell @ 2016-10-16 21:58 UTC (permalink / raw)
  To: 24713

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

Edebug's recursion limit is currently 150, but this is not enough for
the following files in the Emacs source tree:

lisp/calc/calc-ext.el
lisp/help-macro.el
lisp/international/fontset.el

The latter two can be successfully instrumented with edebug-max-depth
set to 200, but the minimum value necessary for calc-ext.el is somewhere
between 500 and 1000. All three of these files contain large quoted
lists.

I'm attaching a patch to accomplish this. I chose to mention
max-lisp-eval-depth and max-specpdl-size in the defcustom docstring, but
I also noticed that Edebug temporarily bumps max-lisp-eval-depth up by
800 while it's working. I could modify the patch to replace the 800 by
something along the lines of (+ 200 (* max-edebug-depth 4)), if someone
with more Emacs experience than me says it is a good idea. Edebug also
increases max-specpdl-size (by 2000) so that probably would also need to
be changed in the code.


[-- Attachment #2: 0001-Change-edebug-max-depth-from-defconst-to-defcustom.patch --]
[-- Type: text/plain, Size: 1707 bytes --]

From 860deea4d3ff07c105435ac36c8477fcb6e1d008 Mon Sep 17 00:00:00 2001
From: gazally <gazally@users.noreply.github.com>
Date: Sun, 16 Oct 2016 13:34:56 -0700
Subject: [PATCH] Change edebug-max-depth from defconst to defcustom

Make edebug-max-depth customizable to give Edebug the ability to
instrument code containing very large quoted lists.
* lisp/emacs-lisp/edebug.el (edebug-max-depth): Add defcustom.
---
 lisp/emacs-lisp/edebug.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 6918539..facbda8 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -112,6 +112,18 @@ edebug-eval-macro-args
   :type 'boolean
   :group 'edebug)
 
+(defcustom edebug-max-depth 150
+  "Maximum recursion depth when instrumenting code.
+This limit stops recursion if an Edebug specification contains an
+infinite loop. When Edebug is instrumenting code containing very
+large quoted lists, it may reach this limit and give the error
+message \"Too deep - perhaps infinite loop in spec?\" You can
+safely make this limit considerably larger than its default
+value, but you may also need to increase `max-lisp-eval-depth'
+and `max-specpdl-size'."
+  :type 'integer
+  :group 'edebug)
+
 (defcustom edebug-save-windows t
   "If non-nil, Edebug saves and restores the window configuration.
 That takes some time, so if your program does not care what happens to
@@ -1452,7 +1464,6 @@ edebug-list-form
 (defvar edebug-after-dotted-spec nil)
 
 (defvar edebug-matching-depth 0)  ;; initial value
-(defconst edebug-max-depth 150)  ;; maximum number of matching recursions.
 
 
 ;;; Failure to match
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#24713: 26.0.50; edebug-max-depth should be customizable
  2016-10-16 21:58 bug#24713: 26.0.50; edebug-max-depth should be customizable Gemini Lasswell
@ 2017-02-04 11:05 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2017-02-04 11:05 UTC (permalink / raw)
  To: Gemini Lasswell; +Cc: 24713-done

> From: Gemini Lasswell <gazally@runbox.com>
> Date: Sun, 16 Oct 2016 14:58:44 -0700
> 
> Edebug's recursion limit is currently 150, but this is not enough for
> the following files in the Emacs source tree:
> 
> lisp/calc/calc-ext.el
> lisp/help-macro.el
> lisp/international/fontset.el
> 
> The latter two can be successfully instrumented with edebug-max-depth
> set to 200, but the minimum value necessary for calc-ext.el is somewhere
> between 500 and 1000. All three of these files contain large quoted
> lists.
> 
> I'm attaching a patch to accomplish this.

Thanks, pushed.

A few minor nits for the future:

 . when you add/modify a defcustom, always specify a :version tag
 . please always mention the bug number in the commit log message,
   otherwise it must be added by hand, which is error-prone
 . user-visible changes should be accompanied by suitable changes to
   NEWS and the manuals (I did it this time)
 . please use the US English convention of leaving 2 spaces between
   sentences -- this is what we use in Emacs documentation
 . please configure your Git repo (on Github?) so that your user name
   is identical to what you use to send email, to avoid confusion





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-04 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 21:58 bug#24713: 26.0.50; edebug-max-depth should be customizable Gemini Lasswell
2017-02-04 11:05 ` Eli Zaretskii

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.