emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87tx8she9x.fsf@yahoo.fr> (raw)

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.

             reply	other threads:[~2014-05-14  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  9:59 Nicolas Richard [this message]
2014-05-15  9:12 ` 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/)] Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tx8she9x.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).