all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anders Lindgren <andlind@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 19576@debbugs.gnu.org, Alan Mackenzie <acm@muc.de>
Subject: bug#19576: write-file writes the wrong buffer
Date: Tue, 17 Nov 2015 22:15:07 +0100	[thread overview]
Message-ID: <CABr8ebbw0vPPwLT-+8JB_LgTzNtstTPEW5KUDp_r2OBrOVZ4hQ@mail.gmail.com> (raw)
In-Reply-To: <87fv05phpw.fsf@mail.linkov.net>

[-- Attachment #1: Type: text/plain, Size: 5833 bytes --]

Hi Everybody!

(I took the liberty to add Eli to this as well, as this involves the
display engine.)


Meanwhile, I'm taking an opportunity to ask you about your intriguing
> comment
> in follow.el:
>
> ;; Almost like the real thing, except when the cursor ends up outside
> ;; the top or bottom...  In our case however, we end up outside the
> ;; window and hence we are recentered.  Should we let `recenter' handle
> ;; the point position we would never leave the selected window.  To do
> ;; it ourselves we would need to do our own redisplay, which is easier
> ;; said than done.  (Why didn't I do a real display abstraction from
> ;; the beginning?)
>
> What a real display abstraction would you create if you designed
> follow-mode today?
>


Unfortunately, I haven't got a clue what my twenty-years younger me was
thinking when writing this...


However, here are some thoughts on follow-mode I have accumulated over the
years:

* The core of follow-mode call `redisplay' and does all sorts of tricks to
keep up the illusion that a number of windows form a very tall windows. I
would like to do some investigations if this can be done more efficiently.
Keith David Bershatsky (a.k.a. lawlist) has analyzed under which
circumstances Emacs calls the different hooks and functions using a tool he
named `test-mode'. Maybe this information can be used to write a better
implementation of follow-mode. (Of course, one alternative would be to
implement this in the Emacs display engine, but I don't see that happening
anytime soon.)

* The Emacs display engine tries to recenter windows when window-start ==
buffer-end, to ensure that no window would appear empty. When follow-mode
is enabled, this is not what we want (except for the leftmost window). To
counter the recentering efforts of Emacs, follow-mode sets window-start
whenever it gets a chance. I would prefer if it was possible to tell the
display engine to leave some windows alone, preferably with some kind of
buffer-local `recenter-window-functions' variable. It could be made generic
so that the return value would be an integer telling Emacs to show this
many lines (if positive) or place the last line X lines from the bottom
(when negative). If such hook existed, follow-mode could return 0 for all
(except the leftmost) windows. Note that the user can change the content of
any window at any time, so this property isn't static.

* Make it easier for other packages to use it. By this I mean packages that
display information, like "grep", should be able to use follow mode to
display a buffer using side by side windows. Concretely, in
font-lock-studio (a debugger for font-lock keywords I wrote a while ago) I
do this, but I had to call `follow-post-command-hook' explicitly. Follow
mode should need a better interface for this, alternatively this should be
built into `display-buffer' so that it happens automatically.

* When follow-mode is enabled, there is a noticeable lag when updating the
region. You can see this by pressing C-c SPACE and holding the up or down
key. When follow-mode is disabled, the region is updated as fast as the
cursor moves, when enabled, it is updated in chunks.

* When written in the Emacs old era, the region was always highlighted in
all windows. Follow-mode went to great lengths to place the cursor in the
non-selected windows so that the region would look good. Today, one could
get the same effect by setting `highlight-nonselected-windows' (except that
the region is visible on the last line of windows to the left of the
selected window.)  I would love to give the user the option to 1)
automatically set this variable and move the cursor in the non-selected
windows or 2) don't move the cursors at all. (Alternatively, invent a new
way to highlight the region of the selected windows in the other windows,
without the cursor in the non-selected windows affecting it.)

* isearch: If I recall correctly, isearch used to worked across follow-mode
windows. Of course, this was before isearch highlighted matches etc. It
would be great if this could be restored once again!

* Process output: In early versions of follow-mode, it could be used with
any process. This was accomplished using `defadvice' on a handful of
process-related functions. At some point in time, this system was replaced
with a system specific to comint and compilation buffers -- as part of the
great defadvice sweep. Personally, I would like to Emacs to provide
`pre-process-output-functions' and `post-process-output-functions',
allowing packages like follow-mode to perform whatever action they would
like to the output of any process.

* If a user have columns with different widths, follow-mode can't correctly
display long lines stretching from one window to the next. The reason for
this is that the start position can't be placed at an arbitrary location on
a long line, only on positions that are a multiple of the column width. I
don't see any way to solve this without modifying the display engine.

* Automatic tests: These should verify the basic functionality, that the
windows are aligned properly. That moving the point down in one window
would move it to the next. All follow-mode-specific commands etc.


Anyway, this is a dire wish-list and I feel that I, unfortunately,
presently can't contribute to it. When it comes to Emacs responsibilities,
I have taken over the NextStep port after Jan Djärvs resignation, and on a
personal level I have a full time job and I have two small children and a
third due in about a week (if all goes well). Anyway, I'm glad that Alan
has taken this bull by the horn. However, feel free to ask questions or
discuss implementation ideas regarding this.

Sincerely,
    Anders Lindgren

[-- Attachment #2: Type: text/html, Size: 7200 bytes --]

  parent reply	other threads:[~2015-11-17 21:15 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 [this message]
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
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=CABr8ebbw0vPPwLT-+8JB_LgTzNtstTPEW5KUDp_r2OBrOVZ4hQ@mail.gmail.com \
    --to=andlind@gmail.com \
    --cc=19576@debbugs.gnu.org \
    --cc=acm@muc.de \
    --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.