unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: npostavs@gmail.com, emacs-devel@gnu.org
Subject: Re: "after" variable watchers
Date: Mon, 17 May 2021 19:57:42 +0300	[thread overview]
Message-ID: <83y2cds3g9.fsf@gnu.org> (raw)
In-Reply-To: <3431d752-559a-7d33-e2fb-2d81dd6cc794@gmx.at> (message from martin rudalics on Mon, 17 May 2021 18:40:09 +0200)

> Cc: npostavs@gmail.com, emacs-devel@gnu.org
> From: martin rudalics <rudalics@gmx.at>
> Date: Mon, 17 May 2021 18:40:09 +0200
> 
>  > But the watcher function already gets the new value, so why do we need
>  > to be able to call it after the variable's value was changed?
> 
> Because knowing the new value in the watch function is of no practical
> use.  I'd have to pass it down to all functions called directly or
> indirectly by the watch function that make use of that value.

Sorry, I don't understand.  I really don't, not even after reading
your explanations.  (Assuming I understood the explanations: they seem
to mix what you intend to do with this "after-watcher" and what you
would have needed with the current watcher machinery, so it's
difficult to figure out which is which.)

Perhaps taking a single example and explaining how would this work
with today's watchers and with the feature you want to install could
help me understand.

>  > In general, this is a debugging feature, while you seem to be
>  > describing a use case where the watcher will be a constant part of an
>  > implementation of some feature, is that right?
> 
> Right.  In the mold of your `add-variable-watcher' at the end of
> frame.el.

So if I remove those, you will retract this proposal?

And note that the analogy is incomplete at best: the watchers in
frame.el watch _variables_ that we used to have forever, so making
them modifiable only via accessor functions would be a breaking
change.  Whereas you are talking about stuff which is done by
functions already.

>  > First, I'd like to better understand the need for this.
> 
> First, it's useful for having a change in a buffer's decorations take
> effect immediately.  So we get rid of things like
> 
>    Setting this variable does not take effect until a new buffer is displayed
>    in a window.  To make the change take effect, call ‘set-window-buffer’.

I think this could be a step in the wrong direction.  It might be
easier for users, but it makes it harder for us to develop Emacs in
the long run, for example if we want more threading.  That's because
all those global and buffer-local variables are part of the huge
global state we have, and that gets in the way of some features.

> And finally we would get rid of the present mixture of errors thrown at
> the user and that of changes that are silently ignored whenever a
> decoration does not fit.  A user then can set the nominal width of the
> right margin to some arbitrary number.  When the window is large enough
> to accommodate it, it will be displayed that way.  When the window gets
> too small, it will be temporarily clipped or skipped.

So we get silent fixes for all of them?  Not sure this is an
improvement.  I think we already had complaints about silently
"fixing" the decorations as we see fit.



  reply	other threads:[~2021-05-17 16:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17  8:27 "after" variable watchers martin rudalics
2021-05-17 10:23 ` Eli Zaretskii
2021-05-17 16:40   ` martin rudalics
2021-05-17 16:57     ` Eli Zaretskii [this message]
2021-05-18 15:10       ` martin rudalics
2021-05-20 13:46         ` Eli Zaretskii
2021-05-24  8:47           ` martin rudalics
2021-05-27 16:51             ` Eli Zaretskii
2021-06-06  7:42               ` martin rudalics
2021-05-17 18:36     ` Stefan Monnier
2021-05-17 18:45       ` Eli Zaretskii
2021-05-17 18:54         ` Stefan Monnier
2021-05-17 18:55           ` Stefan Monnier
2021-05-18 15:10       ` martin rudalics
2021-05-18 15:57         ` Stefan Monnier
2021-05-18 17:01           ` martin rudalics
2021-05-20 13:49             ` Eli Zaretskii
2021-05-24  8:48               ` martin rudalics
2021-05-27 16:53                 ` Eli Zaretskii
2021-05-17 14:57 ` Matt Armstrong
2021-05-17 16:41   ` martin rudalics

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y2cds3g9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=npostavs@gmail.com \
    --cc=rudalics@gmx.at \
    /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 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).