unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: "C. Michailidis" <signal3@gmail.com>, 56110@debbugs.gnu.org
Subject: bug#56110: 27+; switching from line-mode to char-mode
Date: Sun, 26 Jun 2022 04:17:26 -0400	[thread overview]
Message-ID: <jwvh747dew4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87wnd5aqdq.fsf@web.de> (Michael Heerdegen's message of "Sat, 25 Jun 2022 14:17:53 +0200")

> First: Don't buffer local variables come with the same problem?

The problem is somewhat orthogonal to buffer-local vs global, yes.

> Second: When somebody changes a binding using `add/remove-function` with
> a scope limited to the scope of my `let', we have no problem.

Indeed.

> So let's assume a global scope is wanted.  Then that somebody still has
> to figure out what exactly to add-function to, and if the currently seen
> value is not the global one, or what the scope of the currently seen
> binding is.  Bindings can be local or buffer local.

The same holds if they want to use `let` (except that it's a lot more
difficult to let-bind the global value of a variable when there is
a buffer-local value).

> Then one has to figure out if the binding (variable), or the value is to
> be modified.

I don't understand what you mean by that.

> You yourself got it wrong in this case.  So using
> `add/remove-function` is still absolutely nontrivial if I used
> `add-function' instead of `let'.

Yup.  The purpose is not to protect you from your own errors, but to let
you write code whose semantics is more precisely the ones you need such
that the interaction with other code out there will be correct even for
"unexpected" code.

> Finally, what about variables that can be bound to functions but also
> other types like strings?  You can't use `add-function' on them, right?

That's right (well, you still can if the variable currently holds
a function, but it's less convenient in any case).


        Stefan






  reply	other threads:[~2022-06-26  8:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 14:20 bug#56110: 27+; switching from line-mode to char-mode C. Michailidis
2022-06-21 11:47 ` Michael Heerdegen
2022-06-21 12:20   ` Michael Heerdegen
2022-06-22 17:23     ` Michael Heerdegen
2022-06-22 19:22       ` signal3
2022-06-22 21:14         ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-22 22:23           ` signal3
2022-06-23  0:02       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-23 16:56         ` Michael Heerdegen
2022-06-23 21:45           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-25 12:17             ` Michael Heerdegen
2022-06-26  8:17               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-06-26 11:24                 ` Michael Heerdegen
2022-06-26 12:23                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-26 13:04                     ` Michael Heerdegen
2022-06-26 15:15                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-26 14:49             ` Michael Heerdegen
2022-06-26 15:08               ` Andreas Schwab
2022-06-26 15:30                 ` Michael Heerdegen
2022-06-26 16:01               ` signal3
2022-06-26 18:00                 ` Michael Heerdegen
2022-06-26 18:39                   ` Michael Heerdegen
2022-06-26 18:40                   ` Lars Ingebrigtsen
2022-06-26 18:44                     ` Michael Heerdegen

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=jwvh747dew4.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56110@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=signal3@gmail.com \
    /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).