From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: bzg@gnu.org, Nicolas Richard <theonewiththeevillook@yahoo.fr>,
emacs-orgmode@gnu.org
Subject: Re: navigation broken - occur, org-babel-goto-named-src-block, etc fail
Date: Sun, 15 Jun 2014 21:49:29 +0200 [thread overview]
Message-ID: <871tuqymuu.fsf@yahoo.fr> (raw)
In-Reply-To: <alpine.OSX.2.00.1406150805400.360@charles-berrys-macbook.local> (Charles C. Berry's message of "Sun, 15 Jun 2014 08:07:19 -0700")
Hello Charles,
"Charles C. Berry" <ccberry@ucsd.edu> writes:
> On Sun, 15 Jun 2014, Nicolas Richard wrote:
>
>> Charles Berry <ccberry@ucsd.edu> writes:
>>
>>> Start with emacs -q, then load today's org-mode.
>>
>> A glitch in 30220ff was quickly fixed in feca87b (three hours ago).
>> Maybe that's what you see ?
>>
>
> The ECM still fails.
>
> Did it work for you?
Unfortunately I didn't have the time to test, but it seemed very similar
to what I had experienced between these two commits, hence my suggestion
to look into them. I'll try later (and a few hours later...) M-a M-k Let me
try that now.
TL;DR: see near the end.
Ok, so here's what I think I have understood of the problem: In
org-fix-ellipsis-at-bol, we now do
(set-window-start (selected-window) (window-start))
which I thought would be a noop. But it is not, and to understand why
here's a simpler way of reproducing the funny result:
In some buffer with a few screenful of lines, when I do :
M-: (progn (forward-line 55) (set-window-start (selected-window) (window-start)))
(assuming point was at beginning of the buffer) I end up at line 22
(instead of 1+55 = 56) on my current frame/window configurations. (The
number 55 is chosen so that it is beyond the last line of the buffer.)
Now if I try this:
(progn (forward-line 55) (redisplay) (set-window-start (selected-window) (window-start)))
then it works perfectly fine.
So my conclusion is that in the first version, the command loop of emacs
doesn't redraw/recompute the window start position before the end of the
command, i.e. we have the following actions :
(progn
;; let's assume point is a position 1.
(forward-line 55)
;; now point is at line 56, but (window-start) is still at 1.
;; if we used (redisplay) now, then (window-start) would be recomputed.
(set-window-start
(selected-window)
(window-start)))
;; at this point, the command loop was instructed to make the window start at
;; position 1. But point is at line 56, which is out of the window,
;; hence emacs moves point to put it back in the window (namely, in its
;; center).
See (info "(elisp) Window Start and End") for more info on how
set-window-start works when point ends up out of the window.
TL;DR begins here: Hence we could either use the optional arg "NOFORCE"
or force (redisplay) before set-window-start. Both would probably the
bug you're seeing, but I'm not sure any of those is TRT in
org-fix-ellipsis-at-bol.
(BTW if you try to fix org-fix-ellipsis-at-bol in a running emacs, be
sure to re-eval the definition of its callers because it's a defsubst
and IIUC that gets inlined automatically.)
--
Nico.
prev parent reply other threads:[~2014-06-15 19:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-14 21:35 navigation broken - occur, org-babel-goto-named-src-block, etc fail Charles Berry
2014-06-15 13:02 ` Nicolas Richard
2014-06-15 13:09 ` Nicolas Richard
2014-06-15 15:07 ` Charles C. Berry
2014-06-15 19:49 ` Nicolas Richard [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871tuqymuu.fsf@yahoo.fr \
--to=theonewiththeevillook@yahoo.fr \
--cc=bzg@gnu.org \
--cc=ccberry@ucsd.edu \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.