GNU bug report logs - #10805
24.0.93; edebug-trace t may cause stuff being inserted into current buffer

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Mon, 13 Feb 2012 22:31:02 UTC

Severity: normal

Found in version 24.0.93

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 10805 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: michael_heerdegen <at> web.de
Cc: 10805 <at> debbugs.gnu.org
Subject: Re: bug#10805: 24.0.93; edebug-trace t may cause stuff being inserted
	into current buffer
Date: Tue, 14 Feb 2012 11:53:48 +0100
> 1. emacs -Q
> 2. I write this into the scratch buffer:
>      (defun f (x) (if (> x 0) (* x (f (1- x))) 0))
>    and do M-1 C-M-x
> 3. M-: (setq edebug-trace t) RET
> 4. M-: (f 5) RET
>
> Then, "{ f args: (5)" is inserted into *scratch*.
>
> The bug is related to this commented code at the end of
> `edebug-pop-to-buffer':
>
>   ;; Selecting the window does not set the buffer until command loop.
>   ;;(set-buffer buffer)
>
> If I uncomment this call to `set-buffer', the problem disappears.
>
> Seems the one who commented this line of code wanted to test if it is
> (still) needed - seems it is.

More or less so, yes.  This is yet another incarnation of the "unless
WINDOW already is the selected window, its buffer becomes the current
buffer" problem of `select-window'.

We have three possibilites to fix this:

(1) Fix this in `select-window' and friends.  This should be done sooner
    or later but I'm not sure whether "now" is the right moment.

(2) Fix this by uncommenting the line above.  I suppose, however, that
    line was commented out on purpose, hence we might experience more
    surprises in edebug.

(3) Do something like the patch below.  This is the most conservative
    approach and will consequently fail to fix similar problems.  Note
    also that my experience with `edebug-trace' is zero.

martin


*** lisp/emacs-lisp/edebug.el	2012-01-19 07:21:25 +0000
--- lisp/emacs-lisp/edebug.el	2012-02-14 10:43:52 +0000
***************
*** 4129,4146 ****
  ;;	  (point) (window-start))
    (let* ((oldbuf (current-buffer))
  	 (selected-window (selected-window))
! 	 (buffer (get-buffer-create buf-name))
! 	 buf-window)
  ;;    (message "before pop-to-buffer") (sit-for 1)
      (edebug-pop-to-buffer buffer)
!     (setq truncate-lines t)
!     (setq buf-window (selected-window))
!     (goto-char (point-max))
!     (insert (apply 'edebug-format fmt args) "\n")
!     ;; Make it visible.
!     (vertical-motion (- 1 (window-height)))
!     (set-window-start buf-window (point))
!     (goto-char (point-max))
  ;;    (set-window-point buf-window (point))
  ;;    (edebug-sit-for 0)
      (bury-buffer buffer)
--- 4129,4145 ----
  ;;	  (point) (window-start))
    (let* ((oldbuf (current-buffer))
  	 (selected-window (selected-window))
! 	 (buffer (get-buffer-create buf-name)))
  ;;    (message "before pop-to-buffer") (sit-for 1)
      (edebug-pop-to-buffer buffer)
!     (with-current-buffer buffer
!       (setq truncate-lines t)
!       (goto-char (point-max))
!       (insert (apply 'edebug-format fmt args) "\n")
!       ;; Make it visible.
!       (vertical-motion (- 1 (window-height)))
!       (set-window-start nil (point))
!       (goto-char (point-max)))
  ;;    (set-window-point buf-window (point))
  ;;    (edebug-sit-for 0)
      (bury-buffer buffer)






This bug report was last modified 12 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.