bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#52290: 28.0.90; Undocumented generalized variables


From: Lars Ingebrigtsen
Subject: bug#52290: 28.0.90; Undocumented generalized variables
Date: Sun, 05 Dec 2021 21:43:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> I would want to limit this to the kind of side effect: is it undoubtedly
> clear what it is, is there a "canonical" side effect?

Nope, I don't think so.

Some time back, somebody wrote a library to make Emacs more
functional-ish, and the main bugaboo was Emacs' buffer concept.  I get
the feeling that many (some) people that haven't encountered it before
are just horrified by it.  "You mean...  you put...  text!!!...  into a
... buffer!!!!...  and then you operate on it!?  WHERE"S MY SMELLING
SALTS"

So the library was like (remove-empty-lines BUF) which returned a new
buffer with the empty lines removed.  (I think.  My brain may be making
that bit up.)

> This is the case e.g. for `buffer-modified-p' to a high degree, but
> not for e.g. `point-max': there are several ways to achieve that
> `point-max' will return a certain value - killing a certain amount of
> text, for example.  Or narrowing.  Narrowing was not the thing that
> came to my mind first.  A setter for it might cause confusion because
> the semantics are not clear, in contrast to `buffer-modified-p', I
> think, where it is quite clear.

Yeah, I think so to.  "Setting" `point-max' could mean so many different
things, but setting `buffer-modified-p' can only mean one thing, I
think.  (And note that `buffer-modified-p' has an (optional) buffer
parameter), so if we go by "a setter should always mention the object
it's setting", we're kinda covered.)

> I mean, Emacs is an editor, so we have more aspects of state than
> variable bindings.  Setting variables can also have other side effects
> than simply changing the variable's binding.  Per se I don't see a
> problem in considering more kinds of state (more than variables) as
> places.  OTOH, `point-max' for example is not really a self-contained
> part of state, it's a value of a computation, a derived value.
>
> The classification result can be a bit subjective and depend on the
> viewing point, of course.

Indeed.  I think `point' is perhaps the debatable tipping, er, point.
`(decf (point))' is pretty hard to misunderstand (as a synonym for
`(backward-char 1)'), but I think even that's too ... obscure.
Probably.

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





reply via email to

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