bug#32628: 26; Rename `window-setup-hook'

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Drew Adams
The doc string even admits that this name is bad:

  (The name of this hook is due to historical reasons, and does not
   reflect its purpose very well.)

Why not rename it now, and deprecate the old name, aliasing it to the
new name?

What should the new name be?  Maybe something like
`after-set-frame-parameters-startup-hook'?

In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Juri Linkov-2
> The doc string even admits that this name is bad:
>
>   (The name of this hook is due to historical reasons, and does not
>    reflect its purpose very well.)
>
> Why not rename it now, and deprecate the old name, aliasing it to the
> new name?
>
> What should the new name be?  Maybe something like
> `after-set-frame-parameters-startup-hook'?

This is the clear winner of the contest for the longest hook name.



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Drew Adams
> > What should the new name be?  Maybe something like
> > `after-set-frame-parameters-startup-hook'?
>
> This is the clear winner of the contest for the longest hook name.

So far...  ;-)  Please suggest a good name.

I'm probably OK with nearly any name that tries to suggest what this is really for.

`*-startup-hook' makes sense, I think, given the context and the other `*-startup-hook'.

`after-*' is conventional.

Not sure how to shorten `set-frame-parameters', to get across what is done. Maybe `set-frame-params'?



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Juri Linkov-2
>> > What should the new name be?  Maybe something like
>> > `after-set-frame-parameters-startup-hook'?
>>
>> This is the clear winner of the contest for the longest hook name.
>
> So far...  ;-)  Please suggest a good name.
>
> I'm probably OK with nearly any name that tries to suggest what this is really for.
>
> `*-startup-hook' makes sense, I think, given the context and the other `*-startup-hook'.
>
> `after-*' is conventional.
>
> Not sure how to shorten `set-frame-parameters', to get across what is done. Maybe `set-frame-params'?

Looking at the existing hooks in startup.el:

before-init-hook
after-init-hook
emacs-startup-hook
term-setup-hook
inhibit-startup-hooks
window-setup-hook

maybe a better rename for window-setup-hook would be

after-init-frames-hook

or even

after-frames-setup-hook



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Drew Adams
>> > `after-set-frame-parameters-startup-hook'
> > I'm probably OK with nearly any name that tries to suggest what this is really for.
>
> Looking at the existing hooks in startup.el:
> before-init-hook
> after-init-hook
> emacs-startup-hook
> term-setup-hook
> inhibit-startup-hooks
> window-setup-hook
>
> maybe a better rename for window-setup-hook would be after-init-frames-hook
> or even after-frames-setup-hook

The frame settings involved are user settings; it's not about the init frame without user settings.

The latter name is OK: after-frames-setup-hook.



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Juri Linkov-2
>>> > `after-set-frame-parameters-startup-hook'
>> > I'm probably OK with nearly any name that tries to suggest what this is really for.
>>
>> Looking at the existing hooks in startup.el:
>> before-init-hook
>> after-init-hook
>> emacs-startup-hook
>> term-setup-hook
>> inhibit-startup-hooks
>> window-setup-hook
>>
>> maybe a better rename for window-setup-hook would be after-init-frames-hook
>> or even after-frames-setup-hook
>
> The frame settings involved are user settings; it's not about the init frame without user settings.
>
> The latter name is OK: after-frames-setup-hook.

Actually the prefix after- implies there is its counterpart before- like in
before-init-hook and after-init-hook.  So we don't need the prefix after-,
that leaves just frames-setup-hook.  Is it better than window-setup-hook?



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Drew Adams
> >> maybe a better rename for window-setup-hook would be after-init-frames-hook
> >> or even after-frames-setup-hook
> >
> > The frame settings involved are user settings; it's not about the init frame without user settings. The latter name is OK: after-frames-setup-hook.
>
> Actually the prefix after- implies there is its counterpart before-

I don't think it does.

> like in before-init-hook and after-init-hook.

The existence of some such pairs doesn't at all suggest, let alone
imply, that either before or after must be paired with the other.

The point of before and after is to signify occurrence relative to
some other action/time.

There is after-change-major-mode-hook. No such before hook.
There is after-setting-font-mode-hook. No such before hook.
There is bookmark-after-jump-hook. No such before hook.
There is change-major-mode-after-body-hook. No such before hook.
There is dframe-after-select-attached-frame-hook. No such before hook.
There is ediff-after-quit-hook-internal. No such before hook.
There is find-function-after-hook. No such before hook.
There is imenu-after-jump-hook. No such before hook.
There is input-method-after-insert-chunk-hook. No such before hook.
There is rmail-after-get-new-mail-hook. No such before hook.
There is speedbar-after-create-hook. No such before hook.

There is before-hack-local-variables-hook. No such after hook.
There is before-make-frame -hook. No such after hook.
There is ediff-before-setup-hook. No such after hook.
There is speedbar-before-delete-hook. No such after hook.
There is speedbar-before- popup-hook. No such after hook.
There is speedbar-before-visiting-file-hook. No such after hook.
There is speedbar-before-visiting-tag-hook. No such after hook.
There is vc-before-checkin-hook. No such after hook.

> So we don't need the prefix after-,

I think we do. Or rather, I think it helps.

> that leaves just frames-setup-hook.  Is it better than window-setup-hook?

I prefer after-frames-setup-hook. But I've already said that I'm probably OK with whatever you decide. I'm OK with it.



Reply | Threaded
Open this post in threaded view
|

bug#32628: 26; Rename `window-setup-hook'

Juri Linkov-2
> I prefer after-frames-setup-hook.

Not a bad name.  There is also the prefix post- used for some hooks
like post-command-hook, so post-frames-setup-hook is another variant.

It's difficult to choose a good name, but I agree that the current
window-setup-hook is misleading.  I guess it was meant to be named
window-system-setup-hook.