all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Anders Lindgren <andlind@gmail.com>
Cc: juri@linkov.net, 19576@debbugs.gnu.org, acm@muc.de
Subject: bug#19576: write-file writes the wrong buffer
Date: Thu, 19 Nov 2015 17:31:58 +0200	[thread overview]
Message-ID: <83vb8y80pd.fsf@gnu.org> (raw)
In-Reply-To: <CABr8ebZBtW98Uypz7FKmPwz=CityzkK3Y61-NNAjRYV2MwBGuQ@mail.gmail.com>

> Date: Thu, 19 Nov 2015 07:54:32 +0100
> From: Anders Lindgren <andlind@gmail.com>
> Cc: Juri Linkov <juri@linkov.net>, martin rudalics <rudalics@gmx.at>, Alan Mackenzie <acm@muc.de>, 
> 	19576@debbugs.gnu.org
> 
>      I don't see any spontaneous recentering after that, so a reproducible
>     test case will be appreciated.  Maybe something that makes the
>     difference hides behind "work with Emacs for a while", I don't know.
> 
> It's hard to give an exact recipe, because the recentering occurs stochastically. Sometimes, it occurs within a few seconds, sometimes within a minute and sometimes the window stays like it is for a long period of time.

> The fact remains that a window where window-start equals point-max (i.e. a window displaying nothing) do recenter itself from time to time.

I could only understand that if whatever you do following a call to
set-window-start includes resizing of windows or creation/deletion of
windows.  Or maybe you meant editing in that window?  Even then at
least the simple commands I tried don't do that.

The display engine generally doesn't do anything unless the screen
should change.  So if you work outside of the window whose starting
point you forced, Emacs should never do anything with that window.

> My proposal is to modify the display engine so that instead of simply recentering a window, it should call a hook to determine if the recentering should take place.

The display engine doesn't recenter because it needs recentering.
Recentering is a means to achieve a specific goal, it isn't the goal
itself.  The goal is to determine the window's starting point when the
previous starting point cannot be used for some reason.  This is a
crucial part of the display of each window -- without determining
window-start, the display engine cannot proceed with displaying the
window.

So you cannot tell the display engine not to recenter, because it
won't know how to proceed.  I could understand if you'd ask for a way
to tell the display engine not to try redisplaying a certain window.
But disabling just the recentering is not in general possible, AFAIU.

(Actually, Emacs doesn't necessarily recenter: user options like
scroll-conservatively dictate how it finds a good candidate for
window-start, and recentering is just the simplest and the fastest
method.  But this doesn't seem to matter for the purposes of this
discussion, since you'd like to suppress _any_ kind of scrolling, I
believe.)

> This can be made more of less fancy -- a simple solution would be to return a boolean. A more advances solution could let a lisp function in packages to decide how many lines should be visible.

I'm not sure I understand: how many lines are visible is determined by
the window height and the height of the font(s) used by the text
displayed there.  Once these parameters are fixed, you cannot control
the number of lines visible in a window, except by changing the window
height.  What am I missing?

>     Doesn't this mean that you need a way to hook buffer text changes?
>     Hooking processes is not necessarily what you want, since a process
>     filter could eat up the output completely and not show it in any
>     window, in which case follow-mode shouldn't be bothered.  Right?
> 
> Right. However, the difference is rather academic since it would probably few cases where a prior filter would eat all output.

ispell and gdb-mi come to mind, and there are probably more examples.

> When it comes to bug#19576 (write-file saves the wrong buffer). As both John and Eli think this shouldn't be fixed in the Emacs core, I will correct the code in follow-mode and (if needed) update the documentation to warn others of the dragons in these waters.

Thanks.





  reply	other threads:[~2015-11-19 15:31 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 23:37 bug#19576: 24.4; Broken function in `window-size-change-functions' cause `write-file' to write the wrong buffer Anders Lindgren
2015-11-16 19:18 ` bug#19576: write-file writes " Anders Lindgren
2015-11-16 19:46   ` martin rudalics
2015-11-16 20:05     ` Anders Lindgren
2015-11-17  0:55       ` Juri Linkov
2015-11-17 20:02         ` Alan Mackenzie
2015-11-17 21:52           ` Anders Lindgren
2015-11-18  0:27             ` Juri Linkov
2015-11-18  1:37               ` Drew Adams
2015-11-18  7:54               ` Anders Lindgren
2015-11-18 17:45           ` Eli Zaretskii
2015-11-18 23:23             ` Alan Mackenzie
2015-11-19 16:03               ` Eli Zaretskii
2015-11-20  8:22                 ` martin rudalics
2015-11-20 10:17                   ` Eli Zaretskii
2015-11-20 10:48                     ` martin rudalics
2015-11-20 11:16                       ` Eli Zaretskii
2015-11-20 11:25                         ` martin rudalics
2015-11-20 11:40                           ` Eli Zaretskii
2015-11-20 14:21                             ` martin rudalics
2015-11-20 14:54                               ` Eli Zaretskii
2015-11-21 11:35                 ` Eli Zaretskii
2015-11-21 15:56                   ` Alan Mackenzie
2015-11-21 16:01                     ` Eli Zaretskii
2015-11-21 16:49                       ` Anders Lindgren
2015-11-21 17:10                         ` Eli Zaretskii
2015-11-21 18:27                         ` martin rudalics
2015-11-21 18:33                           ` Eli Zaretskii
2015-11-21 18:44                             ` martin rudalics
2015-11-21 19:08                               ` Eli Zaretskii
2015-11-21 20:33                                 ` Anders Lindgren
2015-11-22 10:44                                 ` martin rudalics
2015-11-22 15:36                                   ` Eli Zaretskii
2015-11-21 16:02                     ` bug#21333: " Eli Zaretskii
2015-11-22 11:08                   ` martin rudalics
2015-11-22 15:39                     ` Eli Zaretskii
2015-11-22 17:46                       ` martin rudalics
2015-11-23 18:21                         ` Eli Zaretskii
2015-11-23 18:28                           ` Alan Mackenzie
2015-11-24  8:27                           ` martin rudalics
2015-11-24 16:19                             ` Eli Zaretskii
2015-11-28 10:26                   ` martin rudalics
2015-11-28 11:27                     ` Eli Zaretskii
2015-11-30 13:30                       ` martin rudalics
2015-11-30 16:28                         ` Eli Zaretskii
2015-11-30 17:27                           ` martin rudalics
2015-11-19  8:13             ` martin rudalics
2015-11-19 15:45               ` Eli Zaretskii
2015-11-20  8:22                 ` martin rudalics
2015-11-20  8:34                   ` Eli Zaretskii
2015-11-20 10:25                     ` martin rudalics
2015-11-20 11:15                       ` Eli Zaretskii
2015-11-20 11:25                         ` martin rudalics
2015-11-20 11:39                           ` Eli Zaretskii
2015-11-20 14:21                             ` martin rudalics
2015-11-20 11:32                         ` Alan Mackenzie
2015-11-20 11:41                           ` Eli Zaretskii
2015-11-17 21:15         ` Anders Lindgren
2015-11-18 17:52           ` Eli Zaretskii
2015-11-18 19:23             ` Anders Lindgren
2015-11-18 20:52               ` Eli Zaretskii
2015-11-19  2:06                 ` John Wiegley
2015-11-19  6:54                 ` Anders Lindgren
2015-11-19 15:31                   ` Eli Zaretskii [this message]
2015-11-22 18:44                     ` Johan Bockgård
2015-11-22 18:55                       ` Johan Bockgård
2015-11-22 19:02                       ` Eli Zaretskii
2015-11-17  8:34       ` martin rudalics
2015-11-17 19:08         ` Anders Lindgren
2015-11-18 17:24         ` Eli Zaretskii
2015-11-19  8:12           ` martin rudalics
2015-11-19 15:44             ` Eli Zaretskii
2015-11-20  8:22               ` martin rudalics
2015-11-20  8:32                 ` Eli Zaretskii
     [not found] ` <mailman.9.1447720293.31583.bug-gnu-emacs@gnu.org>
2015-11-17 22:10   ` Alan Mackenzie
2015-11-18  7:09     ` martin rudalics
2015-11-20 20:17 ` bug#19576: Fixed: " Anders Lindgren

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=83vb8y80pd.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=19576@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=andlind@gmail.com \
    --cc=juri@linkov.net \
    /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.