all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter
       [not found] ` <20210724091628.9C95920D0A@vcs0.savannah.gnu.org>
@ 2021-07-24  9:30   ` Lars Ingebrigtsen
  2021-07-24 14:28     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-24  9:30 UTC (permalink / raw)
  To: emacs-devel

larsi@gnus.org (Lars Ingebrigtsen) writes:

> +       (not (provided-mode-derived-p mode 'special-mode))))

This may be too strict...  on the other hand, perhaps the check should
be even stricter -- perhaps a whitelist of allowed modes?  (Perhaps (by
default) populated from `auto-mode-alist'.)

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



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

* Re: master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter
  2021-07-24  9:30   ` master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter Lars Ingebrigtsen
@ 2021-07-24 14:28     ` Stefan Monnier
  2021-07-24 15:46       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2021-07-24 14:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen [2021-07-24 11:30:20] wrote:
> larsi@gnus.org (Lars Ingebrigtsen) writes:
>> +       (not (provided-mode-derived-p mode 'special-mode))))
> This may be too strict...  on the other hand, perhaps the check should
> be even stricter -- perhaps a whitelist of allowed modes?  (Perhaps (by
> default) populated from `auto-mode-alist'.)

Could you clarify what is the purpose of this test?

AFAICT the test that "corresponds" to what we do for file-local
variables is just to check the `-mode` suffix (since we accept any
`mode:foo` and call `foo-mode`).

So if you think we should make it stricter for the dir-local
auto-mode-alist, maybe we should also make it stricter for the
file-local `mode:` thingy.


        Stefan




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

* Re: master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter
  2021-07-24 14:28     ` Stefan Monnier
@ 2021-07-24 15:46       ` Lars Ingebrigtsen
  2021-07-24 16:42         ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-24 15:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> This may be too strict...  on the other hand, perhaps the check should
>> be even stricter -- perhaps a whitelist of allowed modes?  (Perhaps (by
>> default) populated from `auto-mode-alist'.)
>
> Could you clarify what is the purpose of this test?
>
> AFAICT the test that "corresponds" to what we do for file-local
> variables is just to check the `-mode` suffix (since we accept any
> `mode:foo` and call `foo-mode`).

Emacs queries you about stuff like "mode: tex-mode", though -- the
current .dir-locals.el thing does not, which makes it kinda
... dangerous...

> So if you think we should make it stricter for the dir-local
> auto-mode-alist, maybe we should also make it stricter for the
> file-local `mode:` thingy.

Or we could add querying to the new dir-local/auto-mode-alist thing to
bring some parity, but I think that could be annoying?  Or...  since the
queryer offers to store the answer, perhaps it won't be?

It's not immediately obvious to me what the right trade-offs between
security and usability is here.  I think that, basically, all our
built-in (non-special) modes are pretty much safe to use here.  (Or
perhaps all modes descended from text-mode and prog-mode?)  So I'd
prefer being able to use all those in this .dir-locals.el construct
without Emacs querying me about those...

Or something?  Anybody got any ideas?

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



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

* Re: master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter
  2021-07-24 15:46       ` Lars Ingebrigtsen
@ 2021-07-24 16:42         ` Stefan Monnier
  2021-07-24 16:53           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2021-07-24 16:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen [2021-07-24 17:46:13] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> This may be too strict...  on the other hand, perhaps the check should
>>> be even stricter -- perhaps a whitelist of allowed modes?  (Perhaps (by
>>> default) populated from `auto-mode-alist'.)
>>
>> Could you clarify what is the purpose of this test?
>>
>> AFAICT the test that "corresponds" to what we do for file-local
>> variables is just to check the `-mode` suffix (since we accept any
>> `mode:foo` and call `foo-mode`).
>
> Emacs queries you about stuff like "mode: tex-mode", though -- the

To do the same as an auto-mode-alist of (BLA . tex-mode) you'd put

    mode: tex

[ rather than `mode : tex-mode`.  ]
When would such a thing query the user before calling `tex-mode`?


        Stefan




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

* Re: master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter
  2021-07-24 16:42         ` Stefan Monnier
@ 2021-07-24 16:53           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-24 16:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Emacs queries you about stuff like "mode: tex-mode", though -- the
>
> To do the same as an auto-mode-alist of (BLA . tex-mode) you'd put
>
>     mode: tex
>
> [ rather than `mode : tex-mode`.  ]

D'oh.

> When would such a thing query the user before calling `tex-mode`?

No, it doesn't.

Well, perhaps the extra checks should be removed, then.

It's a bit more "spooky action at a distance", though -- if you visit
"/home/foo/bar/zot.baz", and there's a "/home/foo/.dir-locals.el" file,
it'll get the mode stuff applied.

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



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

end of thread, other threads:[~2021-07-24 16:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20210724091626.2905.69508@vcs0.savannah.gnu.org>
     [not found] ` <20210724091628.9C95920D0A@vcs0.savannah.gnu.org>
2021-07-24  9:30   ` master 9ac6ff5: Make the test for auto-mode-alist from .dir-local.el stricter Lars Ingebrigtsen
2021-07-24 14:28     ` Stefan Monnier
2021-07-24 15:46       ` Lars Ingebrigtsen
2021-07-24 16:42         ` Stefan Monnier
2021-07-24 16:53           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.