From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Bug: Activating org-mode in any buffer recenters (unrelated) selected window. [8.2.6 (release_8.2.6-6-gfc37d1 @ /home/youngfrog/sourcetrees/org-mode/lisp/)] Date: Wed, 14 May 2014 11:59:22 +0200 Message-ID: <87tx8she9x.fsf@yahoo.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVyH-0003QS-Nv for emacs-orgmode@gnu.org; Wed, 14 May 2014 05:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkVyA-0002FO-65 for emacs-orgmode@gnu.org; Wed, 14 May 2014 05:59:33 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:64495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkVy9-0002Ex-Oi for emacs-orgmode@gnu.org; Wed, 14 May 2014 05:59:26 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org The function `org-overview' calls `recenter' without checking if the current buffer is actually in the currently selected window. Moreover, turning on org-mode calls `org-overview' (I guess depending on the configuration). IOW, turning on org-mode programmatically (e.g. via find-file-noselect) will recenter whatever window is currently selected. That's unexpected. I noticed that because I recently tried org-notify, which uses find-file-noselect, and the behaviour was very distracting to me. (Side question : do people live with that or is it just me seeing the weird behaviour ?) Anyway, I would suggest to simply remove the call to recenter because I don't understand why it's there. OTOH if it's there for a reason, then I suggest something along the line of: (when (eq (current-buffer) (window-buffer (selected-window))) (recenter '(4))) (but then, why the interactive-looking argument ?) While I am at it, I don't quite understand why (goto-char) is used *after* recenter (also, why not just save-excursion ?) Since there are many things I obviously don't understand, I'm not posting an actual patch but I can do that if someone wants it. -- Nico.