bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19576: write-file writes the wrong buffer


From: Anders Lindgren
Subject: bug#19576: write-file writes the wrong buffer
Date: Tue, 17 Nov 2015 22:52:53 +0100

Hi Alan (and the rest of you)!

First, I'm really glad that you have taken on the challange to modernize follow mode!


On Tue, Nov 17, 2015 at 02:55:39AM +0200, Juri Linkov wrote:
> >> Conceptually it should be easy to do that.  Save/restore current buffer,
> >> selected window and frame.  But Alan (concerned about ‘follow-mode’),
> >> Pip (who unfortunately disappeared) and Eli are currently discussing how
> >> to fix ‘window-size-change-functions’ in various other ways as well.

I have a fix for the `window-size-change-functions' problem, which I
posted just over an hour ago (see bug #21869 or #21333).  The fix
consists of only invoking w-s-c-f after any change to the echo area size
has been done.  This might have some relevance for the current bug.  (I
haven't followed the current bug, I'm afraid.)  I really need the
go-ahead from Eli before I can commit the fix to the emacs-25 or master
branch.

Today Martin sent me a patch that solved the window-size-change-functions problem i reported in bug#19576. I think this is different from the varying echo area problems of the other bugs, though.


In general, follow mode is wonderful (I use it all the time),

I'm glad to hear it! I use it evert day too, and every time I do I'm glad that I invested the time to write it.


but
(i) is not sufficiently integrated with the rest of Emacs, and
(ii) is too difficult to use in an emacs -Q.

By (ii), I mean that manually creating the side by side windows and
doing M-x follow-mode is too cumbersome.
follow-delete-other-windows-and-split is not bound to any key sequence
by default.  I have my own private commands bound to C-c 2, C-c 3, C-c
4, which enable follow mode in 2, 3, and 4 windows.  I also have C-c 0,
which disables follow mode.  I think Emacs should have something like
these in its global key map, say on C-x w f.  Maybe for Emacs 25.2, or
26.1.

I agree, I use an Emacs frame with six columns spread out across two monitors, and it feels like many of the basic functions are missing.

I while a go I put together a companion program for follow mode which I named "multicolumn". It provides functions to set up the frame to accommodate a number of side-by-side windows. It also resizes the frame (down to the pixel) for this. Also it defines a number of keys like "C-x <" and "C-x >" for going to the leftmost and rightmost window, respectively.

You can find this at https://github.com/Lindydancer/multicolumn.


By (i), I mean that other lisp programs cannot use follow mode.  For
example, many programs use `window-start' to get the start of the area
they want to work on, when really what they should get is the start of
the "lowest" follow window.

Agreed.

One thing that disturbs me (which I haven't fixed yet) is when a new buffer is displayed in the middle of a group of follow-mode windows. It would be a good idea to teach `display-buffer' to pick another window, like one the first or last instead.


  I have, as yet, two
alternative implementations for this:
(i) New functions with names like window*-start (notice the "*"),
written in lisp in window.el;

Maybe "window-group-start"? The "*" disappears easily and a window group could actually be something else than a follow-mode group.


(ii) Adding an extra parameter to the primitives (mainly in window.c),
so that instead of calling (window-start win), a function would call
(window-start win t).

Buffer local variables to perform the redirection are initialised at
follow-mode start up, and removed at follow-mode termination.

Of the above alternatives, Eli prefers (ii), but I think Juri prefers
(i).

I can't say that it matters, really, but I think that I would prefer (i) since 1) it's stands out more in the source and 2) it's an all-lisp implementation.

Sincerely,
    Anders Lindgren


reply via email to

[Prev in Thread] Current Thread [Next in Thread]