unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36618: 26.2; Misnamed `*-hooks' variables
@ 2019-07-12 15:16 Drew Adams
  2019-07-13 14:05 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2019-07-12 15:16 UTC (permalink / raw)
  To: 36618

The following variable names end in `-hooks', instead of `-hook' or
`-functions' (there may be more - just noticed these in one of my
sessions):

bookmark-exit-hooks                    (OBS)
delay-mode-hooks                       (Bool)
delayed-mode-hooks                     XXX
ediff-before-session-group-setup-hooks XXX
find-file-hooks                        (OBS)
find-file-not-found-hooks              (OBS)
inhibit-modification-hooks             (Bool)
inhibit-point-motion-hooks             (Bool)
inhibit-startup-hooks                  (Bool)
local-write-file-hooks                 (OBS)
mail-yank-hooks                        (OBS)
recentf-used-hooks                     XXX
unload-feature-special-hooks           (aliased)
write-contents-hooks                   (OBS)
write-file-hooks                       (OBS)

Those marked "OBS" are declared to be obsolete.  Nothing need be done
now for those.

I suggest that `unload-feature-special-hooks', which is already aliased
to `load-hist-hook-functions', be made obsolete.

The ones marked "Bool" are not hooks.  They are Boolean values
indicating whether some behavior associated with particular hooks takes
place - e.g., whether mode hooks should be delayed.  I suggest that
these be renamed to indicate this.  We could, for example, follow the
convention (still encouraged by RMS) of adding the suffix `-flag'.

The ones marked "XXX" are also not hooks.  They're lists of hooks.  I
suggest they be re-suffixed `-functions' and the old names declared
obsolete.

[A code comment for `ediff-before-session-group-setup-hooks' says this:
 ;FIXME: Bad name (should be -hook or -functions) and never run??]

There's some ambiguity in the use of suffix `-functions'.  (elisp)
`Standard Hooks' says that it _usually_ means an abnormal hook.  But it
seems that sometimes it means just a list of hooks that some code will
do something with (not necessarily invoke them as abnormal hooks).

If we wanted to use a different suffix, to distinguish actual abnormal
hooks from such other lists of hooks (normal and abnormal) then those
marked "XXX" here fall into the latter group.


In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
 of 2019-04-13
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor `Microsoft Corp.', version 10.0.17134
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





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

* bug#36618: 26.2; Misnamed `*-hooks' variables
  2019-07-12 15:16 bug#36618: 26.2; Misnamed `*-hooks' variables Drew Adams
@ 2019-07-13 14:05 ` Lars Ingebrigtsen
  2019-07-13 17:23   ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-13 14:05 UTC (permalink / raw)
  To: Drew Adams; +Cc: 36618

Drew Adams <drew.adams@oracle.com> writes:

> The following variable names end in `-hooks', instead of `-hook' or
> `-functions' (there may be more - just noticed these in one of my
> sessions):
>
> bookmark-exit-hooks                    (OBS)

As you say, there's nothing to be done about obsolete -hooks variables.

> delay-mode-hooks                       (Bool)

These bool variables have logical names -- they say whether to do
something or other about the hooks, so I don't think they should change
names.

> delayed-mode-hooks                     XXX

That's not really a -hook variable, but list of hook variables to run,
so it's fine:

(defvar-local delayed-mode-hooks nil
  "List of delayed mode hooks waiting to be run.")

> ediff-before-session-group-setup-hooks XXX

This is a variable that's never used, apparently?  I'll just mark it as
obsolete.

> recentf-used-hooks                     XXX

It's a list of hooks, not a hook, so has a correct name.

> unload-feature-special-hooks           (aliased)

Same.

Nothing to be done for the rest; closing.

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





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

* bug#36618: 26.2; Misnamed `*-hooks' variables
  2019-07-13 14:05 ` Lars Ingebrigtsen
@ 2019-07-13 17:23   ` Drew Adams
  2019-07-13 17:34     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2019-07-13 17:23 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 36618

> > The following variable names end in `-hooks', instead of `-hook' or
> > `-functions' (there may be more - just noticed these in one of my
> > sessions):
> >
> > bookmark-exit-hooks                    (OBS)
> 
> As you say, there's nothing to be done about obsolete -hooks variables.
> 
> > delay-mode-hooks                       (Bool)
> 
> These bool variables have logical names -- they say whether to do
> something or other about the hooks, so I don't think they should change
> names.
> 
> > delayed-mode-hooks                     XXX
> 
> That's not really a -hook variable, but list of hook variables to run,
> so it's fine:
> 
> (defvar-local delayed-mode-hooks nil
>   "List of delayed mode hooks waiting to be run.")
> 
> > ediff-before-session-group-setup-hooks XXX
> 
> This is a variable that's never used, apparently?  I'll just mark it as
> obsolete.
> 
> > recentf-used-hooks                     XXX
> 
> It's a list of hooks, not a hook, so has a correct name.
> 
> > unload-feature-special-hooks           (aliased)
> 
> Same.
> 
> Nothing to be done for the rest; closing.

IOW, "won't fix".

Lists of hooks are not hooks.  Boolean variables that
control behavior of hooks are not hooks.

A user looking for hooks will fall upon these misleading
names of non-hooks using completion (e.g. substring).

We can help her or mislead her.  Currently we throw noise
in her face.  Not much noise - there are only a few such
anomalies cited here.





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

* bug#36618: 26.2; Misnamed `*-hooks' variables
  2019-07-13 17:23   ` Drew Adams
@ 2019-07-13 17:34     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2019-07-13 17:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: larsi, 36618

> Date: Sat, 13 Jul 2019 10:23:23 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 36618@debbugs.gnu.org
> 
> A user looking for hooks will fall upon these misleading
> names of non-hooks using completion (e.g. substring).

Not necessarily: we have a section in the ELisp manual that lists all
the standard hooks.





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

* bug#36618: 26.2; Misnamed `*-hooks' variables
       [not found]     ` <<83o91xzvm3.fsf@gnu.org>
@ 2019-07-13 17:46       ` Drew Adams
  2019-07-13 17:50         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2019-07-13 17:46 UTC (permalink / raw)
  To: Eli Zaretskii, Drew Adams; +Cc: larsi, 36618

> > A user looking for hooks will fall upon these misleading
> > names of non-hooks using completion (e.g. substring).
> 
> Not necessarily: we have a section in the ELisp manual that lists all
> the standard hooks.

A user looking for hooks is not necessarily looking
for _standard_ hooks, and she is not necessarily
looking for coverage of hooks in the manual.

As one simple example, `C-h v' with various types
of completion (substring is one example, but there
are others) can match such non-hook variables.
Similarly, searches.

Hook naming conventions are documented.  And hook
names have been improved over the years to better
reflect the conventions.  There are a few functions
that mislead by their names.  That misleading is
not needed - it doesn't help anything.





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

* bug#36618: 26.2; Misnamed `*-hooks' variables
  2019-07-13 17:46       ` Drew Adams
@ 2019-07-13 17:50         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2019-07-13 17:50 UTC (permalink / raw)
  To: Drew Adams; +Cc: larsi, 36618

> Date: Sat, 13 Jul 2019 10:46:12 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: larsi@gnus.org, 36618@debbugs.gnu.org
> 
> There are a few functions that mislead by their names.

I disagree that they mislead.  What is misleading in
inhibit-modification-hooks? its name says exactkly what it does.

"Hook" is not a reserved word in variable names; it makes no sense to
avoid calling a variable that inhibits some hooks by a name that
doesn't mention "hooks".

You are trying to impose unnecessary burden on variable names.





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

end of thread, other threads:[~2019-07-13 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 15:16 bug#36618: 26.2; Misnamed `*-hooks' variables Drew Adams
2019-07-13 14:05 ` Lars Ingebrigtsen
2019-07-13 17:23   ` Drew Adams
2019-07-13 17:34     ` Eli Zaretskii
     [not found] <<aed10b21-f313-4fd1-ac95-64d5f2f49451@default>
     [not found] ` <<87d0ievxm5.fsf@mouse.gnus.org>
     [not found]   ` <<2b8f5747-6d20-494a-b727-fdd0b9245299@default>
     [not found]     ` <<83o91xzvm3.fsf@gnu.org>
2019-07-13 17:46       ` Drew Adams
2019-07-13 17:50         ` Eli Zaretskii

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