[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57003: 28.1.90; Can local variables be loaded before loading major m
From: |
Ihor Radchenko |
Subject: |
bug#57003: 28.1.90; Can local variables be loaded before loading major mode? |
Date: |
Sun, 07 Aug 2022 21:23:01 +0800 |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I see. In that case, it does seem attractive to allow file-local
> variables to set the variables before running the mode. However, as
> Visuwesh points out, a major mode clears buffer-local variables, so just
> setting them before running the mode won't do anything.
Indeed. I imagine something like :before-hook in `define-derived-mode'
that will run just before the mode body.
Or maybe more direct :hack-local-variables-when defining when to run
`hack-local-variables' in contrast to currently hard-coded call in
`run-mode-hooks'. This is not equivalent to calling
`hack-local-variables' in :before-hook because `run-mode-hooks' would
call `hack-local-variables' second time in such a case.
Or maybe something more user-facing like major-mode-before-init-hook
that will be executed before the major mode body form in
`define-derived-mode'.
> So I think the interface here is just a bit confused and confusing. It
> would make more sense to allow users to do these things via mode
> hooks/interface functions instead of variables.
Agree. However, the file-local variables specifically are not equivalent
to the mode hooks. File/directory-local variables can be set on
per-file/per-project basis, which is much more convenient compared to
explicitly defining a global hook.
Best,
Ihor
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/05
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/06
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/06
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/07
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?,
Ihor Radchenko <=
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/07
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/07
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/08
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/08
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/08
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/08
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/08
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Ihor Radchenko, 2022/08/09
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Lars Ingebrigtsen, 2022/08/12
- bug#57003: 28.1.90; Can local variables be loaded before loading major mode?, Phil Sainty, 2022/08/12