From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#17724: 24.4.50;
	regression: error "`recenter'ing a window that does not
	display	current-buffer." when opening org-mode file
Date: Sat, 07 Jun 2014 19:26:35 +0300
Message-ID: <83r4303cuc.fsf@gnu.org>
References: <87bnu4ww4i.fsf@boo.workgroup>
Reply-To: Eli Zaretskii <eliz@gnu.org>
NNTP-Posting-Host: plane.gmane.org
X-Trace: ger.gmane.org 1402158444 13503 80.91.229.3 (7 Jun 2014 16:27:24 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 7 Jun 2014 16:27:24 +0000 (UTC)
Cc: 17724@debbugs.gnu.org
To: Gregor Zattler <grfz@gmx.de>, Bastien Guerry <bzg@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 07 18:27:17 2014
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1WtJSd-0007Rx-4f
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jun 2014 18:27:15 +0200
Original-Received: from localhost ([::1]:52371 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1WtJSc-0004iH-Oh
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jun 2014 12:27:14 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54898)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WtJSV-0004gh-Hq
	for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 12:27:12 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WtJSQ-000233-JC
	for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 12:27:07 -0400
Original-Received: from debbugs.gnu.org ([140.186.70.43]:49549)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WtJSQ-00022z-Fx
	for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 12:27:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WtJSQ-0007tb-78
	for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 12:27:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 07 Jun 2014 16:27:02 +0000
Resent-Message-ID: <handler.17724.B17724.140215841230328@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 17724
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
Original-Received: via spool by 17724-submit@debbugs.gnu.org id=B17724.140215841230328
	(code B ref 17724); Sat, 07 Jun 2014 16:27:02 +0000
Original-Received: (at 17724) by debbugs.gnu.org; 7 Jun 2014 16:26:52 +0000
Original-Received: from localhost ([127.0.0.1]:40699 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1WtJSF-0007t5-NG
	for submit@debbugs.gnu.org; Sat, 07 Jun 2014 12:26:52 -0400
Original-Received: from mtaout27.012.net.il ([80.179.55.183]:40269)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eliz@gnu.org>) id 1WtJSC-0007sf-0X
	for 17724@debbugs.gnu.org; Sat, 07 Jun 2014 12:26:49 -0400
Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il
	(HyperSendmail v2007.08) id <0N6T00B0045A3J00@mtaout27.012.net.il> for
	17724@debbugs.gnu.org; Sat, 07 Jun 2014 19:23:36 +0300 (IDT)
Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0N6T00APH47CN700@mtaout27.012.net.il>;
	Sat, 07 Jun 2014 19:23:36 +0300 (IDT)
In-reply-to: <87bnu4ww4i.fsf@boo.workgroup>
X-012-Sender: halo1@inter.net.il
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=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:90163
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/90163>

> From: Gregor Zattler <grfz@gmx.de>
> Date: Sat, 07 Jun 2014 17:57:17 +0200
> 
> since
> 
> GNU Emacs 24.4.50.1 (i686-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-06 on boo
> 
> emacs-snapshot -Q file.org
> 
> gives:
> 
> File mode specification error: (error "`recenter'ing a window that does not display current-buffer.")
> 
> Note that this error occurs even if file.org is empty or does not exist.
> 
> The same error message prevents computation of the org-agenda with my usual setup which why I found this error and report it.
> 
> 
> I assume that this error is related to this commit:
> commit 0ce71d38bf295205067fd334e1993906f7fb0ba7
> Author:     Stefan Monnier <monnier@iro.umontreal.ca>
> AuthorDate: Fri Jun 6 10:37:05 2014 -0400
> Commit:     Stefan Monnier <monnier@iro.umontreal.ca>
> CommitDate: Fri Jun 6 10:37:05 2014 -0400
> 
> * src/window.c (Frecenter): Signal an error if window-buffer is not
>   current-buffer.

It's a bug in Org, IMO: it recenters the window without making sure
the current buffer's window is selected.  The backtrace below suggests
that org-mode is turned on inside a call to find-file-noselect, which
doesn't select the window of the current buffer.  So this call to
recenter actually recenters the wrong window, the one that displays
*scratch*.

Bastien, could you please look into this?

Breakpoint 3, Frecenter (arg=83507246) at window.c:5644
5644      struct window *w = XWINDOW (selected_window);
(gdb) n
5645      struct buffer *buf = XBUFFER (w->contents);
(gdb)
5646      bool center_p = 0;
(gdb) p buf->name_
$1 = 22325705
(gdb) xtype
Lisp_String
(gdb) xstring
$2 = (struct Lisp_String *) 0x154a9c8 <dumped_data+36648>
"*scratch*"
(gdb) p current_buffer->name_
$3 = 16540225
(gdb) xstring
$4 = (struct Lisp_String *) 0xfc6240
"file.org"
(gdb) bt
#0  Frecenter (arg=83507246) at window.c:5646
#1  0x0118b071 in Ffuncall (nargs=2, args=0x82dd74) at eval.c:2815
#2  0x011cf2cd in exec_byte_code (bytestr=83861729, vector=83857157,
    maxdepth=20, args_template=22298242, nargs=0, args=0x0) at bytecode.c:918
#3  0x0118bbef in funcall_lambda (fun=83857213, nargs=0, arg_vector=0x82df58)
    at eval.c:3049
#4  0x0118b2af in Ffuncall (nargs=1, args=0x82df54) at eval.c:2864
#5  0x011cf2cd in exec_byte_code (bytestr=83856689, vector=83856925,
    maxdepth=8, args_template=22298242, nargs=0, args=0x0) at bytecode.c:918
#6  0x0118bbef in funcall_lambda (fun=83856997, nargs=0, arg_vector=0x82e128)
    at eval.c:3049
#7  0x0118b2af in Ffuncall (nargs=1, args=0x82e124) at eval.c:2864
#8  0x011cf2cd in exec_byte_code (bytestr=83765417, vector=83766885,
    maxdepth=32, args_template=22298242, nargs=0, args=0x0) at bytecode.c:918
#9  0x0118bbef in funcall_lambda (fun=83767565, nargs=0, arg_vector=0x82e320)
    at eval.c:3049
#10 0x0118b2af in Ffuncall (nargs=1, args=0x82e31c) at eval.c:2864
#11 0x011cf2cd in exec_byte_code (bytestr=19649353, vector=19649373,
    maxdepth=20, args_template=2052, nargs=2, args=0x82e520) at bytecode.c:918
#12 0x0118b844 in funcall_lambda (fun=19649333, nargs=2, arg_vector=0x82e518)
    at eval.c:2983
#13 0x0118b2af in Ffuncall (nargs=3, args=0x82e514) at eval.c:2864
#14 0x011cf2cd in exec_byte_code (bytestr=19648737, vector=19648757,
    maxdepth=64, args_template=1024, nargs=0, args=0x82e708) at bytecode.c:918
#15 0x0118b844 in funcall_lambda (fun=19648717, nargs=0, arg_vector=0x82e708)
    at eval.c:2983
#16 0x0118b2af in Ffuncall (nargs=1, args=0x82e704) at eval.c:2864
#17 0x011cf2cd in exec_byte_code (bytestr=19498393, vector=19643621,
    maxdepth=4, args_template=0, nargs=0, args=0x82e8e4) at bytecode.c:918
#18 0x0118b844 in funcall_lambda (fun=19643597, nargs=0, arg_vector=0x82e8e4)
    at eval.c:2983
#19 0x0118b2af in Ffuncall (nargs=1, args=0x82e8e0) at eval.c:2864
#20 0x01189bba in eval_sub (form=26867454) at eval.c:2157
#21 0x01187dd3 in internal_lisp_condition_case (var=23885034,
    bodyform=26867454, handlers=26867246) at eval.c:1323
#22 0x011cff2b in exec_byte_code (bytestr=19643497, vector=19643517,
    maxdepth=28, args_template=1024, nargs=1, args=0x82ec60)
    at bytecode.c:1164
#23 0x0118b844 in funcall_lambda (fun=19643469, nargs=1, arg_vector=0x82ec5c)
    at eval.c:2983
#24 0x0118b2af in Ffuncall (nargs=2, args=0x82ec58) at eval.c:2864
#25 0x011cf2cd in exec_byte_code (bytestr=19642817, vector=19642837,
    maxdepth=44, args_template=5120, nargs=2, args=0x82ee5c) at bytecode.c:918
#26 0x0118b844 in funcall_lambda (fun=19642797, nargs=2, arg_vector=0x82ee54)
    at eval.c:2983
#27 0x0118b2af in Ffuncall (nargs=3, args=0x82ee50) at eval.c:2864
#28 0x011cf2cd in exec_byte_code (bytestr=19641705, vector=19641725,
    maxdepth=76, args_template=6168, nargs=6, args=0x82f088) at bytecode.c:918
#29 0x0118b844 in funcall_lambda (fun=19641685, nargs=6, arg_vector=0x82f070)
    at eval.c:2983
#30 0x0118b2af in Ffuncall (nargs=7, args=0x82f06c) at eval.c:2864
#31 0x011cf2cd in exec_byte_code (bytestr=19640897, vector=19640917,
    maxdepth=72, args_template=4100, nargs=4, args=0x82f270) at bytecode.c:918
#32 0x0118b844 in funcall_lambda (fun=19640877, nargs=4, arg_vector=0x82f260)
    at eval.c:2983
#33 0x0118b2af in Ffuncall (nargs=5, args=0x82f25c) at eval.c:2864
#34 0x011cf2cd in exec_byte_code (bytestr=19637793, vector=19637813,
    maxdepth=28, args_template=2052, nargs=2, args=0x82f4b0) at bytecode.c:918
#35 0x0118b844 in funcall_lambda (fun=19637765, nargs=2, arg_vector=0x82f4a8)
    at eval.c:2983
#36 0x0118b2af in Ffuncall (nargs=3, args=0x82f4a4) at eval.c:2864
#37 0x01182a9c in Ffuncall_interactively (nargs=3, args=0x82f4a4)
    at callint.c:250
#38 0x0118af56 in Ffuncall (nargs=4, args=0x82f4a0) at eval.c:2796
#39 0x0118a5b4 in Fapply (nargs=3, args=0x82f590) at eval.c:2354
#40 0x01182f05 in Fcall_interactively (function=23468594,
    record_flag=22298242, keys=22323917) at callint.c:399
#41 0x0118b0d3 in Ffuncall (nargs=4, args=0x82f6fc) at eval.c:2822
#42 0x011cf2cd in exec_byte_code (bytestr=19899513, vector=19899533,
    maxdepth=52, args_template=4100, nargs=1, args=0x82f8f0) at bytecode.c:918
#43 0x0118b844 in funcall_lambda (fun=19899493, nargs=1, arg_vector=0x82f8ec)
    at eval.c:2983
#44 0x0118b2af in Ffuncall (nargs=2, args=0x82f8e8) at eval.c:2864
#45 0x0118ab65 in call1 (fn=22344058, arg1=23468594) at eval.c:2614
#46 0x010f9c81 in command_loop_1 () at keyboard.c:1553
#47 0x01187ee1 in internal_condition_case (bfun=0x10f9621 <command_loop_1>,
    handlers=22351570, hfun=0x10f8e92 <cmd_error>) at eval.c:1354
#48 0x010f92f7 in command_loop_2 (ignore=22298242) at keyboard.c:1171
#49 0x011874cc in internal_catch (tag=22344730,
    func=0x10f92d4 <command_loop_2>, arg=22298242) at eval.c:1118
#50 0x010f92af in command_loop () at keyboard.c:1150
#51 0x010f8a4c in recursive_edit_1 () at keyboard.c:771
#52 0x010f8bfc in Frecursive_edit () at keyboard.c:842
#53 0x010f6caf in main (argc=2, argv=0xa427c0) at emacs.c:1656

Lisp Backtrace:
"recenter" (0x82dd78)
"org-overview" (0x82df58)
"org-set-startup-visibility" (0x82e128)
"org-mode" (0x82e320)
"set-auto-mode-0" (0x82e518)
"set-auto-mode" (0x82e708)
0x12bbcc8 PVEC_COMPILED
"funcall" (0x82e8e0)
"normal-mode" (0x82ec5c)
"after-find-file" (0x82ee54)
"find-file-noselect-1" (0x82f070)
"find-file-noselect" (0x82f260)
"find-file" (0x82f4a8)
"funcall-interactively" (0x82f4a4)
"call-interactively" (0x82f700)
"command-execute" (0x82f8ec)