From: Lars Ingebrigtsen <larsi@gnus.org>
To: Reuben Thomas <rrt@sc3d.org>
Cc: 14502@debbugs.gnu.org
Subject: bug#14502: 24.3; dired-load-hook should not be customizable
Date: Fri, 16 Aug 2019 13:50:23 -0700 [thread overview]
Message-ID: <87ftm0q1gw.fsf@mouse.gnus.org> (raw)
In-Reply-To: <CAOnWdogW0rsZ6UOGtvi-ODGoUkVob1_FjsOdMWrDodbQ2b1KLw@mail.gmail.com> (Reuben Thomas's message of "Fri, 16 Aug 2019 09:13:31 +0100")
Reuben Thomas <rrt@sc3d.org> writes:
> dired-x adds dired-extra-startup to dired-mode-hook…
I missed that bit.
> dired-mode-hook in my setup also has sml/set-buffer-identification added by
> smart-mode-line, so yes, it is "one of those hooks"
It seems rather unsatisfactory to have to make a decision between "one
of those hooks" and "the rest of the hooks" on a hook by hook basis...
Stefan wrote in 2013:
> So until Custom is fixed to actually properly handle customisation of
> hooks (e.g. by storing "add functions foo, bar, and baz" rather than
> "ignore current value and just set it to (foo bar baz)").
So I wondered what it would take to fix this in Customize properly. But:
(define-widget 'hook 'list
"An Emacs Lisp hook."
[...]
:set (lambda (symbol value)
(dolist (elt value)
(if (fboundp elt)
(add-hook symbol elt))))
The :set action for hooks doesn't just overwrite the value, but uses
`add-hook' the proper way?
Now I'm even more confused. Hm... Perhaps that's not the code that's
used when actually restoring hook values? Let's see.
(defun customize-set-variable (variable value &optional comment)
[...]
(funcall (or (get variable 'custom-set) #'set-default) variable value)
(get 'gnus-load-hook 'custom-set)
=> nil
So the setter is not used? Hm... Oh, it's only set if you say
(defcustom ...
:set ...)
Right. So the :set in the widget is only used interactively? *tests*
Nope, if I try to modify a hook in a Customize buffer, then it always
overwrites the hook value.
So, as usual, when trying to figure out how Customize works, it's...
just... rather obscure.
But I think one (probably controversial solution) would be to add a
`custom-set' property on all hook variables that would make it use
`add-hook' instead of just overwriting the value. That would make
Customize and add-hook coexist... but would also mean that you can't
set a hook to a specific value with Customize, which will probably break
something for somebody.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2019-08-16 20:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 13:04 bug#14502: 24.3; dired-load-hook should not be customizable Reuben Thomas
2019-08-15 4:42 ` Lars Ingebrigtsen
[not found] ` <CAOnWdoh8TJRpPTiizOZf+RT=wKA45ztc+q_j+dq-9_190=gMWg@mail.gmail.com>
2019-08-16 1:29 ` Lars Ingebrigtsen
2019-08-16 8:13 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-08-16 20:50 ` Lars Ingebrigtsen [this message]
2020-10-28 8:53 ` Stefan Kangas
2019-12-31 13:41 ` Mauro Aranda
2020-01-22 12:27 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ftm0q1gw.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=14502@debbugs.gnu.org \
--cc=rrt@sc3d.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).