unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
@ 2014-09-23 22:56 Andrea Rossetti
  2014-09-24  0:51 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Rossetti @ 2014-09-23 22:56 UTC (permalink / raw)
  To: 18541

Hello, I think I found a bug in ruler-mode,
here's a recipe for it. Start "emacs -Q" and type:

M-x ruler-mode RET 
M-: (set-window-margins nil 10 10) RET

You will see left and right margins will narrow the
sides of *scratch* buffer. Now type

M-x next-buffer RET
M-x previous-buffer RET

  and you will see that the margins have unexpectedly
disappeared, i.e. the *scratch* buffer is shown full-width
without margins.

  May I please ask for a confirm of reproducibility at your side.
And also: does it seem like a bug for you too, or was it just
expected behaviour? 

  Thanks for your time and attention, kindest regards.

  Andrea





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2014-09-23 22:56 bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer Andrea Rossetti
@ 2014-09-24  0:51 ` Stefan Monnier
  2014-09-24 22:14   ` Andrea Rossetti
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-09-24  0:51 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 18541

> Hello, I think I found a bug in ruler-mode,
> here's a recipe for it. Start "emacs -Q" and type:
> M-x ruler-mode RET 
> M-: (set-window-margins nil 10 10) RET

Setting margins with set-window-margins is a low-level operation.
Margins get re-set whenever the buffer displayed is changed.
IOW I think the behavior you describe with above recipe is not a bug.

But indeed, if you set the margin with S-mouse-1 or S-mouse-3 on the
header-line, then ruler-mode should arguably try to preserve this
setting like you request it.


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2014-09-24  0:51 ` Stefan Monnier
@ 2014-09-24 22:14   ` Andrea Rossetti
  2014-09-25  1:09     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Rossetti @ 2014-09-24 22:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18541

Stefan Monnier <monnier@iro.umontreal.ca> writes:
> But indeed, if you set the margin with S-mouse-1 or S-mouse-3 on the
> header-line, then ruler-mode should arguably try to preserve this
> setting like you request it.

  Thanks for your reply Stefan.

  Even if I set margins with S-mouse-1 and S-mouse-3, and then
type M-x next-buffer RET M-x previous-buffer RET , the margins
disappear.

  It could indeed be a nice addition in the future if there's
some agreement. I can't think of a case where margin preservation
could be inappropriate (just a guess: maybe non-interactive sessions?).

  My suggested alternative if one needs to jump around buffers while
keeping margins enabled in a certain buffer: I noticed that the "window
configuration registers" preserve margins properly:

- (... set margins with S-mouse-1 and S-mouse-3 ...)
- C-x r w a
- M-x next-buffer RET
- C-x r j a

Kindest regards,

  Andrea





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2014-09-24 22:14   ` Andrea Rossetti
@ 2014-09-25  1:09     ` Stefan Monnier
  2021-08-19 15:34       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-09-25  1:09 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 18541

>> But indeed, if you set the margin with S-mouse-1 or S-mouse-3 on the
>> header-line, then ruler-mode should arguably try to preserve this
>> setting like you request it.
>   Even if I set margins with S-mouse-1 and S-mouse-3, and then
> type M-x next-buffer RET M-x previous-buffer RET , the margins
> disappear.

Yes, that's what I meant, and this is the actual bug that needs fixing.

>   It could indeed be a nice addition in the future if there's
> some agreement.  I can't think of a case where margin preservation
> could be inappropriate (just a guess: maybe non-interactive sessions?).

There's no reason not to preserve the margin (other than the fact it's
not implemented).  There are questions about *how* to do it, tho.

Mostly, should the margin set by the user be considered as a property of
the buffer (applied wherever the buffer gets displayed), or is it
a property that applies to this buffer but only in this particular window?

E.g. if I have the buffer in window 1 and then display it in window 2,
should window 2 get the same margins as well?  What if window 2 has
a completely different width than window 1?

>   My suggested alternative if one needs to jump around buffers while
> keeping margins enabled in a certain buffer: I noticed that the "window
> configuration registers" preserve margins properly:

> - (... set margins with S-mouse-1 and S-mouse-3 ...)
> - C-x r w a
> - M-x next-buffer RET
> - C-x r j a

Right, that can be a good workaround until ruler-mode does that for you,


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2014-09-25  1:09     ` Stefan Monnier
@ 2021-08-19 15:34       ` Lars Ingebrigtsen
  2021-08-20  8:18         ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 15:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Andrea Rossetti, 18541

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Mostly, should the margin set by the user be considered as a property of
> the buffer (applied wherever the buffer gets displayed), or is it
> a property that applies to this buffer but only in this particular window?
>
> E.g. if I have the buffer in window 1 and then display it in window 2,
> should window 2 get the same margins as well?  What if window 2 has
> a completely different width than window 1?

Those are all very good questions.

Perhaps it only makes sense to restore window margins if we're popping
the same buffer back into the same window?

But that's such an unlikely thing to happen that I'm not sure it's much
of a user interface.  Perhaps restoring it if jumping back to the buffer
in the same frame?

How would we implement this?  Perhaps via a hook in
`window--display-buffer' that `ruler-mode' could set?

Or...  we could just leave it alone, because I suspect that whatever we
do here, it's going to be pretty confusing.  Anybody got an opinion here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2021-08-19 15:34       ` Lars Ingebrigtsen
@ 2021-08-20  8:18         ` martin rudalics
  2021-08-20 13:14           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2021-08-20  8:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Stefan Monnier; +Cc: Andrea Rossetti, 18541

 > Or...  we could just leave it alone, because I suspect that whatever we
 > do here, it's going to be pretty confusing.  Anybody got an opinion here?

Add an option that tells whether S-mouse-1/-3 should set up margins in a
buffer- or window-local way.

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2021-08-20  8:18         ` martin rudalics
@ 2021-08-20 13:14           ` Lars Ingebrigtsen
  2021-08-22  8:24             ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-20 13:14 UTC (permalink / raw)
  To: martin rudalics; +Cc: Andrea Rossetti, Stefan Monnier, 18541

martin rudalics <rudalics@gmx.at> writes:

>> Or...  we could just leave it alone, because I suspect that whatever we
>> do here, it's going to be pretty confusing.  Anybody got an opinion here?
>
> Add an option that tells whether S-mouse-1/-3 should set up margins in a
> buffer- or window-local way.

Yeah, I guess...  but...  is it really useful to restore the margins if
you display the same buffer in a (very) different frame?  (I'm thinking
gui vs. non-gui in an emacsclient setup.)

I think it would be natural to restore margins if the buffer is a window
in the same frame, but that's rather obscure, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer
  2021-08-20 13:14           ` Lars Ingebrigtsen
@ 2021-08-22  8:24             ` martin rudalics
  0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2021-08-22  8:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Andrea Rossetti, Stefan Monnier, 18541

 > Yeah, I guess...  but...  is it really useful to restore the margins if
 > you display the same buffer in a (very) different frame?  (I'm thinking
 > gui vs. non-gui in an emacsclient setup.)

Is it useful to make Ruler mode buffer local?

 > I think it would be natural to restore margins if the buffer is a window
 > in the same frame, but that's rather obscure, too.

Buffer local settings have to be respected anywhere.  A user who sets
the margins in a non-gui frame and switches to a gui frame may want to
see them there as well.

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-22  8:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 22:56 bug#18541: 24.3; ruler-mode: margins are reset when doing next-buffer/previous-buffer Andrea Rossetti
2014-09-24  0:51 ` Stefan Monnier
2014-09-24 22:14   ` Andrea Rossetti
2014-09-25  1:09     ` Stefan Monnier
2021-08-19 15:34       ` Lars Ingebrigtsen
2021-08-20  8:18         ` martin rudalics
2021-08-20 13:14           ` Lars Ingebrigtsen
2021-08-22  8:24             ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).