unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el]
@ 2005-11-21  9:34 David PONCE
  2005-11-28  4:47 ` Richard M. Stallman
  2005-12-06  1:42 ` Richard M. Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: David PONCE @ 2005-11-21  9:34 UTC (permalink / raw)
  Cc: emacs-devel

> Would you please DTRT and then ack?

Sorry for the delay to reply.

[...]
> I'm not sure if this is a real bug or some limitation in the way
> edebug works.  I did the following:
> 1. emacs -q
> 2. M-x load-library RET recentf RET
> 3. M-x recentf-mode
> 4. M-: (setq recentf-list
[...]
> 5. Click on File->Open Recent->Options and set Recentf Menu Filter to
> recentf-arrange-by-mode for current session.
> 6. In the lisp source recentf.el instrument recentf-open-files for
> edebug (C-u M-C-x).
> 7. M-x recentf-open-files
> 8. Step through the function until this sexp:
>    (apply 'widget-create
>            `(group
>              :indent 2
>              :format "\n%v\n"
>              ,@(recentf-open-files-items (or files recentf-list))))
> 
> When ededug hits the end of this sexp, Emacs hangs and starts
> consuming all available CPU cycles.  If I quickly press C-g the
> hanging stops.
[...]

I reproduced the error and also found that Emacs hangs in the built-in
function `prin1-to-string' when it tries to print the value the
function `widget-create' returns, which contains a lot of circular
references in a deeply nested list.  If I don't interrupt the hang,
after some time, the function fails with a "Memory exhausted" message.
Notice that the widgets are correctly created in the "*Open Recent*"
buffer.  This is only the edebug prin1 function that hangs.

When I set the value of `edebug-print-level' to 10 instead of the
default value of 50, Emacs no more hangs.

Maybe there is a bug in the prin1-to-string function?  Unfortunately I
don't know how to fix it.

Or perhaps the default values of `edebug-print-level' and
`edebug-print-length' are too big?

Hope it helps.

David

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el]
@ 2005-11-28  8:19 David PONCE
  2005-11-29  3:11 ` Richard M. Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: David PONCE @ 2005-11-28  8:19 UTC (permalink / raw)
  Cc: emacs-devel

Hi,

> It could be a bug in prin1-to-string.  What is the value
> of print-circle at that time?

It is t.  It is let-bound by the function `edebug-safe-prin1-to-string'
that wraps the built-in `prin1-to-string'.  Here are the relevant parts
of edebug code:

...

(defcustom edebug-print-length 50
  "*Default value of `print-length' for printing results in Edebug."
  :type 'integer
  :group 'edebug)
(defcustom edebug-print-level 50
  "*Default value of `print-level' for printing results in Edebug."
  :type 'integer
  :group 'edebug)
(defcustom edebug-print-circle t
  "*Default value of `print-circle' for printing results in Edebug."
  :type 'boolean
  :group 'edebug)

...

;; Define here in case they are not already defined.
(defvar print-level nil)
(defvar print-circle nil)
(defvar print-readably) ;; defined by lemacs
;; Alternatively, we could change the definition of
;; edebug-safe-prin1-to-string to only use these if defined.

(defun edebug-safe-prin1-to-string (value)
  (let ((print-escape-newlines t)
	(print-length (or edebug-print-length print-length))
	(print-level (or edebug-print-level print-level))
	(print-circle (or edebug-print-circle print-circle))
	(print-readably nil)) ;; lemacs uses this.
    (edebug-prin1-to-string value)))

...

`edebug-prin1-to-string' is an alias for `prin1-to-string'.

Sincerely,
David

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

end of thread, other threads:[~2005-12-14 20:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-21  9:34 [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el] David PONCE
2005-11-28  4:47 ` Richard M. Stallman
2005-12-06  1:42 ` Richard M. Stallman
2005-12-13 22:27   ` Chong Yidong
2005-12-14 20:04     ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2005-11-28  8:19 David PONCE
2005-11-29  3:11 ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).