[Top][All Lists]

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

Re: How to get back to a place in a buffer, or: what is a window configu

From: Marcin Borkowski
Subject: Re: How to get back to a place in a buffer, or: what is a window configuration?
Date: Wed, 03 Aug 2016 20:42:00 +0200
User-agent: mu4e 0.9.16; emacs

On 2016-08-03, at 16:42, Drew Adams <address@hidden> wrote:

>> sometimes I work on a particular place in some buffer,
> A place (position) in a buffer has little or nothing to do with
> windows.

By "place", I meant two things: (1) where the point is and (2) what is
the first (topmost) actually displayed (visible) line.

> It sounds, from the rest of your question, like you are more
> interested in restoring a window configuration.  But your
> question is still unclear, to me.  Hopefully, Kaushal's answer
> gives you what you want.

More or less.  I'm now convinced that window configurations were what
I was looking for.

>> and Emacs for some reason scrolls me out of that place.  I want
>> then to get back to it.
> Getting back to a buffer position is simple - you can use
> temporary bookmarks or the mark ring or other methods.  But
> I don't think that's really what you're asking.

Right, it's not what I meant.

>> Is there a way (in stock Emacs or with help of M?elpa) to
>> accomplish that?
>> Bonus points for a package/command which /temporarily/ disables C-v/M-v
>> and other commands that might result in scrolling text in the window.
> I don't see the connection between that and your request
> (apparently) to restore a window config.  Is it that you really
> (or additionally?) want to prevent moving `window-point'?
> or perhaps prevent it from moving too far?  The underlying
> question or use case is not clear to me.

My goal (though probably not my words;-), sorry) is simple: I want the
"place" (in the sense of the above definition) to stay the same, /or/
I want to be able to easily restore it.  The former should be doable
with narrowing, the latter probably with window configurations.

>> (Narrowing to what is currently visible should do the trick, so
>> a combination of M-r, C-e and C-SPC would probably do what I want.
>> Coding that is three minutes, but maybe someone did it already?)
> If narrowing to what is currently shown in the window is
> what you're looking for, then yes, you can easily code that.
> (If you use library zones.el then you can easily flip among
> multiple narrowings, in case that is related to what you want.

I heard about it, though I don't really see much use (for me, not in
general).  OTOH, I use narrowing quite a lot, so maybe I could give it
a try.

>> Note that it's not the same as keeping a position in a register.
>> A simple experiment shows that keeping a /window configurations/ seems
>> to do what I want,
> `C-x r w' puts window-config in a register.  `C-x r j' restores it.

I learned about it today while rereading the manual.  Very useful

>> but from reading the manual I'm not sure what
>> a "window configuration" really is.  What does a "window
>> configuration" consist of, exactly?
> What part of (elisp) `Window Configurations' is unclear to you?

Well, now I see it...

But look at this:

,----[ (emacs) Configuration Registers ]
| You can save the window configuration of the selected frame in a
| register, or even the configuration of all windows in all frames, and
| restore the configuration later.  *Note Windows::, for information about
| window configurations.

,----[ (emacs) Window Convenience ]
| Winner mode is a global minor mode that records the changes in the
| window configuration (i.e., how the frames are partitioned into
| windows), so that you can undo them.

See?  Basically nothing in the /Emacs manual/ explains precisely what
a "window configuration" is.  On the other hand, the /Elisp reference/
is pretty clear.  I'd consider this a bug in the docs: a /user/ should
not need to consult the Elisp reference.  I'll try to come up with
a patch for the docs soon.


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

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