From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <4F3A3D3C.8020002@gmx.at> References: <87y5s6l63w.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1329216882 31486 80.91.229.3 (14 Feb 2012 10:54:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2012 10:54:42 +0000 (UTC) Cc: 10805@debbugs.gnu.org To: michael_heerdegen@web.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 14 11:54:39 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RxG1s-0001VU-16 for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Feb 2012 11:54:36 +0100 Original-Received: from localhost ([::1]:37485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxG1r-0001Lg-Kh for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Feb 2012 05:54:35 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:58012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxG1o-0001LP-QM for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2012 05:54:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxG1i-0004ba-EA for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2012 05:54:32 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxG1i-0004bW-CY for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2012 05:54:26 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RxG3F-0003X9-Kf for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2012 05:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Feb 2012 10:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10805 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10805-submit@debbugs.gnu.org id=B10805.132921693413547 (code B ref 10805); Tue, 14 Feb 2012 10:56:01 +0000 Original-Received: (at 10805) by debbugs.gnu.org; 14 Feb 2012 10:55:34 +0000 Original-Received: from localhost ([127.0.0.1]:39707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RxG2n-0003WR-Vf for submit@debbugs.gnu.org; Tue, 14 Feb 2012 05:55:34 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:45207) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RxG2l-0003WD-5R for 10805@debbugs.gnu.org; Tue, 14 Feb 2012 05:55:32 -0500 Original-Received: (qmail invoked by alias); 14 Feb 2012 10:53:48 -0000 Original-Received: from 62-47-58-233.adsl.highway.telekom.at (EHLO [62.47.58.233]) [62.47.58.233] by mail.gmx.net (mp029) with SMTP; 14 Feb 2012 11:53:48 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX191Ns4tS4N1VrmsRw31oaCZiiVKF0ESUth++qP11Z NXdVJTGK5Qf7Vp In-Reply-To: <87y5s6l63w.fsf@web.de> X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56885 Archived-At: > 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)