|Subject:||Re: New Package for GNU ELPA|
|Date:||Fri, 27 May 2016 10:26:14 +0000|
IMO the standard add-hook and remove-hook don't seem to need syntactic sugar. The macros in the package lack many things that the default add-hook/remove-hook do and also it is more verbose.
It's not too difficult to define a foo function and add that to a hook using the standard way. And ALWAYS explicitly defining a function first is a good rule of thumb. It applies to hooks and advices both.
Here's what I believe the users will miss out if they use the hook helper macros:
1. Applying function to a local hook.
2. Edebugging a function applied to a hook. I believe that if the macro is crating a function, you would need to macroexpand the macro first and then edebug the function definition shown in the temp buffer, right?
3. Adding the same function to multiple hooks.
4. Brevity of add-hook and remove-hook.
5. Many times you just happen to have a function already defined and you just need to add that to the hook in a concise manner like the below example.
6. Quickly look up the value of a hook with point on the hook name and doing C-h v. Now as the macro uses the hook name without the "-hook" suffix, C-h v will not work that fast. Also user needs to then add ":suffix" when using these macros for non-standard hooks that end in "-functions".
(defconst my/linum-mode-hooks '(verilog-mode-hook
"List of hooks of major modes in which a “linum” mode should be enabled.")
(dolist (hook my/linum-mode-hooks)
(add-hook hook #'linum-mode))
In summary, at least for me, I do not seem to gain more by using these set of macros; it's more verbose and doesn't entirely cover the original add-hook and remove-hook feature set. I would rather educate people to always have defuns and almost never use bare lambda forms in hooks and advices.
PS: "define-mode-hook-helper text" and "define-hook-helper text-mode" seem to do the exact same thing. The macro user is not saving any time by using define-mode-hook-helper; they still need to type "-mode" but at a different place. I don't understand the point of that. And then you have just one remove-hook-helper. That looks inconsistent.
If no one else sees any issue with this, would someone with commit
access to ELPA mind adding hook helpers? If it helps, the git repo is here:
|[Prev in Thread]||Current Thread||[Next in Thread]|