From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37213@debbugs.gnu.org
Subject: bug#37213: Execute set-window-margins. left-margin-width remains 0.
Date: Sat, 31 Aug 2019 11:59:11 +0000 [thread overview]
Message-ID: <20190831115911.GC4822@ACM> (raw)
In-Reply-To: <83o908bhh2.fsf@gnu.org>
Hello, Eli.
On Thu, Aug 29, 2019 at 09:42:17 +0300, Eli Zaretskii wrote:
> > Date: Wed, 28 Aug 2019 19:57:06 +0000
> > Cc: 37213@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > > I don't think this is a bug. This variable is for _setting_ the
> > > margin width, not for _returning_ its width as set "by other means".
> > > See its documentation.
> > The documentation says "This variable specifies the width of the left
> > margin". As best, this is unclear. What you're saying is that the
> > variable ceases to specify that width, should the margin be altered by
> > other means.
> > I maintain that this is either a bug in the documentation, or in the
> > code.
> I'm okay with clarifying the documentation, but let's first agree what
> needs clarifying there.
How about the following, purely pragmatic, patch?
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 7c0a56dcad..428fe9595a 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5016,7 +5016,9 @@ Display Margins
Setting these variables does not immediately affect the window. These
variables are checked when a new buffer is displayed in the window.
Thus, you can make changes take effect by calling
-@code{set-window-buffer}.
+@code{set-window-buffer}. Do not use these variables to try to
+determine the current width of the left or right margin. Instead, use
+the function @code{window-margins}.
You can also set the margin widths immediately.
With this patch applied, I'd be happy for the bug to be closed.
> > If the former, it should explicitly state that the variable is
> > write-only, and its read value is undefined. It should say that the
> > function window-margins should be used instead.
> > But it might be easier just to amend the code. There appear to be just
> > two ways to set the width of the left margin (or the right margin), so
> > if it gets set the second way, why not just set that variable? Could
> > this do any harm? (Note: I haven't looked at the code, yet.)
> Think about it: left-margin-width is a per-buffer variable. A buffer
> can be displayed in zero or more windows, and the margin is a window
> property. How can a single buffer-local variable reflect a value that
> can be different in different windows, and can even be meaningless if
> the buffer is not displayed in any window?
OK.
> What happens in the code is that when a buffer is displayed in a
> window, this variable is consulted, and the window's margin-width
> attribute set accordingly. The window margins can grow or shrink
> thereafter, and the function window-margins then returns this window
> attribute's value at any given moment for a specific window.
Thanks for the explanation.
--
Alan Mackenzie (Nurermberg, Germany).
next prev parent reply other threads:[~2019-08-31 11:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 18:53 bug#37213: Execute set-window-margins. left-margin-width remains 0 Alan Mackenzie
2019-08-28 19:14 ` Eli Zaretskii
2019-08-28 19:57 ` Alan Mackenzie
2019-08-29 6:42 ` Eli Zaretskii
2019-08-31 11:59 ` Alan Mackenzie [this message]
2019-08-31 12:13 ` Eli Zaretskii
2019-08-29 7:46 ` martin rudalics
2019-08-31 14:07 ` Alan Mackenzie
2019-09-01 8:26 ` martin rudalics
2019-09-01 9:48 ` Alan Mackenzie
2019-09-01 12:19 ` martin rudalics
2019-09-01 12:42 ` Alan Mackenzie
2019-08-29 7:46 ` martin rudalics
[not found] ` <handler.37213.B.156701844019660.ack@debbugs.gnu.org>
2019-08-31 14:39 ` Alan Mackenzie
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=20190831115911.GC4822@ACM \
--to=acm@muc.de \
--cc=37213@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.