From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist Date: Sat, 15 Oct 2022 11:35:11 +0000 Message-ID: <87v8ol5ngw.fsf@posteo.net> References: <87sfjsgkl4.fsf@posteo.net> <865ygn4pno.fsf@mail.linkov.net> <87y1tiabq5.fsf@gnus.org> <87czauzhch.fsf@gmail.com> <87k052h1zt.fsf@posteo.net> <87ilkl78cd.fsf@gnus.org> <874jw577gn.fsf@posteo.net> <87ilkl5sow.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14248"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58506@debbugs.gnu.org, Robert Pluim , Juri Linkov , Stefan Kangas , Stefan Monnier To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 15 13:36:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojfSe-0003VG-9X for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Oct 2022 13:36:12 +0200 Original-Received: from localhost ([::1]:51180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojfSd-0007Jp-2v for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Oct 2022 07:36:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojfSU-0007J9-QY for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 07:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojfSU-0001a7-IB for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 07:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ojfSU-0003bI-Cb for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 07:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Oct 2022 11:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58506 X-GNU-PR-Package: emacs Original-Received: via spool by 58506-submit@debbugs.gnu.org id=B58506.166583372613788 (code B ref 58506); Sat, 15 Oct 2022 11:36:02 +0000 Original-Received: (at 58506) by debbugs.gnu.org; 15 Oct 2022 11:35:26 +0000 Original-Received: from localhost ([127.0.0.1]:39638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojfRu-0003aK-25 for submit@debbugs.gnu.org; Sat, 15 Oct 2022 07:35:26 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:47691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojfRo-0003Zx-Qu for 58506@debbugs.gnu.org; Sat, 15 Oct 2022 07:35:24 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id ADF28240104 for <58506@debbugs.gnu.org>; Sat, 15 Oct 2022 13:35:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665833714; bh=19FMFa63YdZwkV1vsXkMGYOeYlMzbWddzRgoPxMuLmk=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=XoSvBjgDvq1ive09ydcClnZlyPbWf8Vwo504KVFkD7unL13/sVB73pILGooeTxFPf 4LyQokXmbAVQVorAunqK4QD0LILeaJQkYZ/pR+KFLc5ni2BoLWlj84xhupVeAnEFOC KV9pGwHoCZ0cQnqUoasvURiBGeWpihWCEn2+gZdvf/dqz+N3LQg/OOVb3oDhEmAeGD lde42H7kEWW/CSlizW06BABHUEeQSppCBh36qpw7Nyav/tMES0m6cvVJOfnT6GKGAV cxWEHEUig2I0sHlOJg2Oz8Rkk23lEWaVuYdyi6QBFStq/YAv1KtjmGZJUjrRhdbPlT SHBVXrtxcueSg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MqLlh19Tkz6tmr; Sat, 15 Oct 2022 13:35:12 +0200 (CEST) In-Reply-To: <87ilkl5sow.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 15 Oct 2022 11:42:23 +0200") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245542 Archived-At: Lars Ingebrigtsen writes: > Philip Kaludercic writes: > >> My only objection to "something like" this is that it appears to be Lisp >> code, and people could get surprised when they try to add something that >> isn't (eg. a regular `add-to-list' call that had a quote -- beginners >> often get tripped up on these minor syntactic points). > > Then I guess `add-to-list' wouldn't be a good "directive" here. Another idea could be to take inspiration from Guile's "Sandboxed Evaluation"[0] and provide a "safe subset" of Elisp that can be evaluated (with some additional checks). E.g. the following would allow evaluating `add-to-list' if the list if safe and the value is self-evaluating: --8<---------------cut here---------------start------------->8--- (cl-defmethod safe-eval ((_fn (eql 'add-to-list)) &rest args) (when-let* ((list-var (nth 0 args)) (element (nth 1 args)) ((macroexp-const-p element)) (append (nth 2 args)) (new-list (if append (append (symbol-value list-var) (list element)) (cons element (symbol-value list-var)))) ((safe-local-variable-p list-var new-list))) (add-to-list list-var element append))) --8<---------------cut here---------------end--------------->8--- [0] https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Sandboxed-Evaluation.html >>> And we'd make the parser backwards/forwards compatible -- i.e., elements >>> that are unknown to the Emacs version running would just be ignored. >> >> Ideally there would be a warning or some way you could find out that >> variables aren't loaded, e.g. if you have a typo in >> `blink-parenthesis-mode' vs. `blink-parentheses-mode'. > > Well, that would make things less backwards/forwards compatible -- > people would be getting warnings when flipping between different Emacs > versions. No, what I had in mind was not to trigger warnings but either to highlight unused variables or provide a command that would check it for you.