unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Obsolete variable in cc-defs.el
@ 2022-10-17  8:59 Lars Ingebrigtsen
  2022-10-17 16:53 ` Alan Mackenzie
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-17  8:59 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

We have one build warning in Emacs currently:

In toplevel form:
progmodes/cc-defs.el:63:21: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead

Alan, could you take a look at that?



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

* Re: Obsolete variable in cc-defs.el
  2022-10-17  8:59 Obsolete variable in cc-defs.el Lars Ingebrigtsen
@ 2022-10-17 16:53 ` Alan Mackenzie
  2022-10-17 21:54   ` Stefan Monnier
  2022-10-17 21:59   ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Mackenzie @ 2022-10-17 16:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Hello, Lars.

On Mon, Oct 17, 2022 at 10:59:00 +0200, Lars Ingebrigtsen wrote:
> We have one build warning in Emacs currently:

> In toplevel form:
> progmodes/cc-defs.el:63:21: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead

> Alan, could you take a look at that?

That is a mistake in declaring inhibit-point-motion-hooks obsolete.  As
long as the properties point_entered and point_left exist and work
(regardless of whether they are declared obsolete),
inhibit-point-motion-hooks is required.  It's use shouldn't (yet)
generate any warnings.

It's obsolesence message is also suboptimal.  cursor-intangible-mode and
friend cannot take i-p-m-h's place.  That role will be fulfilled by the
variable cursor-sensor-inhibit, which really ought to be in
c-save-buffer-state (in cc-defs.el) alongside i-p-m-h.

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Obsolete variable in cc-defs.el
  2022-10-17 16:53 ` Alan Mackenzie
@ 2022-10-17 21:54   ` Stefan Monnier
  2022-10-18  8:26     ` Alan Mackenzie
  2022-10-17 21:59   ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-10-17 21:54 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, emacs-devel

> That is a mistake in declaring inhibit-point-motion-hooks obsolete.  As
> long as the properties point_entered and point_left exist and work
> (regardless of whether they are declared obsolete),
> inhibit-point-motion-hooks is required.  It's use shouldn't (yet)
> generate any warnings.

You don't need to let-bind it to t in Emacs≥25 because its default value
is already t.  So for Emacs≥25 you should simply remove that let-binding.

> It's obsolesence message is also suboptimal.

Indeed: it is meant for the case where you set or let-bind that variable
to nil rather than when you set/bind it to t.

> That role will be fulfilled by the variable cursor-sensor-inhibit,
> which really ought to be in c-save-buffer-state (in cc-defs.el)
> alongside i-p-m-h.

You don't need it there and let-binding it there would have no effect at
all unless the body of `c-save-buffer-state` does things like run
a recursive-edit or pause for redisplay (that var is only consulted
"outside", e.g. from `post/pre-command-hook` or
`pre-redisplay-functions`).


        Stefan




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

* Re: Obsolete variable in cc-defs.el
  2022-10-17 16:53 ` Alan Mackenzie
  2022-10-17 21:54   ` Stefan Monnier
@ 2022-10-17 21:59   ` Stefan Monnier
  2022-10-18  9:30     ` Alan Mackenzie
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-10-17 21:59 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, emacs-devel

> That is a mistake in declaring inhibit-point-motion-hooks obsolete.  As
> long as the properties point_entered and point_left exist and work
> (regardless of whether they are declared obsolete),
> inhibit-point-motion-hooks is required.  It's use shouldn't (yet)
> generate any warnings.

BTW, your code only uses `inhibit-point-motion-hooks` explicitly in
Emacs<23.2.  After that it relies on
`with-silent-modifications` instead.  So the byte-compile obsolescence
warning only comes from

    (cc-bytecomp-defvar inhibit-point-motion-hooks)

which your code can't need when `with-silent-modifications` is `fboundp`.


        Stefan




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

* Re: Obsolete variable in cc-defs.el
  2022-10-17 21:54   ` Stefan Monnier
@ 2022-10-18  8:26     ` Alan Mackenzie
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2022-10-18  8:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel

Hello, Stefan.

On Mon, Oct 17, 2022 at 17:54:12 -0400, Stefan Monnier wrote:
> > That is a mistake in declaring inhibit-point-motion-hooks obsolete.
> > As long as the properties point_entered and point_left exist and
> > work (regardless of whether they are declared obsolete),
> > inhibit-point-motion-hooks is required.  It's use shouldn't (yet)
> > generate any warnings.

> You don't need to let-bind it to t in Emacs≥25 because its default
> value is already t.  So for Emacs≥25 you should simply remove that
> let-binding.

I do need to bind it.  Some obscure minor mode might have set it to nil.
As I said above, until point-entered and point-left have been removed
from Emacs, one needs to bind that variable, just to be safe.  Therefore
it shouldn't yet be marked as obsolete.

> > It's obsolesence message is also suboptimal.

> Indeed: it is meant for the case where you set or let-bind that
> variable to nil rather than when you set/bind it to t.

Yes.

> > That role will be fulfilled by the variable cursor-sensor-inhibit,
> > which really ought to be in c-save-buffer-state (in cc-defs.el)
> > alongside i-p-m-h.

> You don't need it there and let-binding it there would have no effect at
> all unless the body of `c-save-buffer-state` does things like run
> a recursive-edit or pause for redisplay (that var is only consulted
> "outside", e.g. from `post/pre-command-hook` or
> `pre-redisplay-functions`).

OK, those properties are only for display purposes, not for Lisp code.
What about font-locking?  Presumably the cursor-intangible property will
not mess up font-locking, and is only taken into account when redisplay
moves point to outside of such a region.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Obsolete variable in cc-defs.el
  2022-10-17 21:59   ` Stefan Monnier
@ 2022-10-18  9:30     ` Alan Mackenzie
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2022-10-18  9:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel

Hello, Stefan.

On Mon, Oct 17, 2022 at 17:59:13 -0400, Stefan Monnier wrote:
> > That is a mistake in declaring inhibit-point-motion-hooks obsolete.  As
> > long as the properties point_entered and point_left exist and work
> > (regardless of whether they are declared obsolete),
> > inhibit-point-motion-hooks is required.  It's use shouldn't (yet)
> > generate any warnings.

> BTW, your code only uses `inhibit-point-motion-hooks` explicitly in
> Emacs<23.2.  After that it relies on
> `with-silent-modifications` instead.  So the byte-compile obsolescence
> warning only comes from

>     (cc-bytecomp-defvar inhibit-point-motion-hooks)

> which your code can't need when `with-silent-modifications` is `fboundp`.

Indeed.  Which is ironic, given that cc-bytecomp-defvar was invented to
_suppress_ compiler warnings.

I still say a binding of inhibit-point-motion-hooks should be in
with-silent-modifications, although it's not a big thing.  Surely the
intangible text property will "soon" be removed, making the point moot.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



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

end of thread, other threads:[~2022-10-18  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17  8:59 Obsolete variable in cc-defs.el Lars Ingebrigtsen
2022-10-17 16:53 ` Alan Mackenzie
2022-10-17 21:54   ` Stefan Monnier
2022-10-18  8:26     ` Alan Mackenzie
2022-10-17 21:59   ` Stefan Monnier
2022-10-18  9:30     ` Alan Mackenzie

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).