all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 57003@debbugs.gnu.org
Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode?
Date: Sun, 07 Aug 2022 21:52:33 +0800	[thread overview]
Message-ID: <871qts6tzy.fsf@localhost> (raw)
In-Reply-To: <87k07k18ro.fsf@gnus.org>

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> 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.
>
> I think you can say something like
>
> (eval . (org-startup-folded-mode))
>
> to your .dir-locals (etc) to achieve this.  (And then you have to add
> that to `safe-local-eval-forms' to avoid getting prompted, but Org could
> do that in general.  And, of course, add this functionality as a minor
> mode instead of just a variable.)

I do not think that it is a good idea.

1. Having a need to do the eval is not expected by users.
2. Allowing eval is not safe compared to setting variables. Your
   suggestion about `safe-local-eval-forms' will not work well because
   even in your example it is not just about running
   (org-startup-folded-mode); org-startup-folded has 7 allowed values -
   marking each (org-startup-folded-mode value) form as safe sounds
   awkward.
3. org-startup-folded is just an example. We have numerous variables
   like this. I can recall at least several dozens without looking into
   source code. Creating a minor mode for each and every single possible
   variable like this is not maintainable. We will certainly forget
   creating dedicated modes when adding similar variables in future.
4. We have a somewhat similar approach in org-link settings - each link
   type is activated by evaluating a sexp. The result is slow Org
   startup time.

   If we implement per-file settings like you suggested, each setting
   will require partial re-evaluation of (org-mode). 
   A handful of settings like you suggested will easily degrade Org
   startup time by an order of magnitude.

Best,
Ihor





  reply	other threads:[~2022-08-07 13:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 11:44 bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Ihor Radchenko
2022-08-06 13:06 ` Lars Ingebrigtsen
2022-08-06 13:35   ` Ihor Radchenko
2022-08-06 14:00     ` Visuwesh
2022-08-06 14:34       ` Phil Sainty
2022-08-07 12:44     ` Lars Ingebrigtsen
2022-08-07 13:23       ` Ihor Radchenko
2022-08-07 13:30         ` Lars Ingebrigtsen
2022-08-07 13:52           ` Ihor Radchenko [this message]
2022-08-08 11:28             ` Lars Ingebrigtsen
2022-08-08 12:30               ` Ihor Radchenko
2022-08-08 12:35                 ` Lars Ingebrigtsen
2022-08-08 12:58                   ` Ihor Radchenko
2022-08-08 14:23                     ` Lars Ingebrigtsen
2022-08-09 11:29                       ` Ihor Radchenko
2022-08-12 12:38                         ` Lars Ingebrigtsen
2022-08-13  1:33                           ` Phil Sainty
2022-08-13 11:52                             ` Lars Ingebrigtsen
2022-08-13  9:02                           ` Ihor Radchenko
2022-08-13 11:55                             ` Lars Ingebrigtsen
2022-08-13 12:22                               ` Ihor Radchenko
2022-08-13 12:32                                 ` Lars Ingebrigtsen
2022-08-15  3:09                                 ` Richard Stallman
2022-08-15  3:15                                   ` Ihor Radchenko
2022-08-17  2:50                                     ` Richard Stallman
2022-08-17 10:08                                       ` Ihor Radchenko
2022-08-29  3:34                                         ` Richard Stallman
2022-08-31  3:29                                           ` Ihor Radchenko
2022-10-18 13:29     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-29  6:24       ` Ihor Radchenko
2022-10-29 14:40         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-30  2:57           ` Ihor Radchenko
2022-10-30  3:43             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-30  3:51               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-30  4:01                 ` Ihor Radchenko
2022-10-30 12:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-31  3:08                     ` Ihor Radchenko
2022-10-30  6:59               ` Ihor Radchenko

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qts6tzy.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=57003@debbugs.gnu.org \
    --cc=larsi@gnus.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 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.