unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Ihor Radchenko <yantar92@posteo.net>,
	57003@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode?
Date: Sat, 29 Oct 2022 23:43:21 -0400	[thread overview]
Message-ID: <jwvmt9e6m3b.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87pmeaauib.fsf@localhost> (Ihor Radchenko's message of "Sun, 30 Oct 2022 02:57:16 +0000")

>>> However, pretty much all the BODY in Org major mode definition will need
>>> to go into the hook. It feels awkward.
>> The body of a major mode should usually be limited to setting some
>> variables.  All the font-lock highlighting, the imenu scanning, the
>> syntax-propertizing, etc... is done afterwards (the later the better).
> One issue I envision is when unsafe variable dialogue is being
> displayed. If font-locking is not setup prior to that, Emacs will try to
> fontify the visible part of buffer when displaying the dialogue and
> later font-lock settings may not fully apply.
>
> See https://list.orgmode.org/orgmode/878ro8kqwv.fsf@localhost/T/#u

I didn't quite understand the problem from that thread.

Your description above isn't very clear either  On the one hand you say
"font-locking is not setup prior to that" but on the other you say
"Emacs will try to fontify the visible part of buffer" which only
happens if font-lock is setup, AFAIK.

I suggest you open a bug report to get to the bottom of this.

>> The act of folding is not part of "defining" the major mode in my
>> book :-)
> Indeed.  However, a lot more things in Org mode depend on user
> customizations.  For example, buffer-invisibility-spec may be changed
> depending on user settings, including settings defined in file-local
> variables.

I don't see a problem with postpone that to `hack-local-variables-hook', no.
[ Other approaches exist, of course, such as monitoring those config
  vars and updating the other pieces of data that depend on them
  whenever needed.  ]

>>> Will moving the whole major mode definition into
>>> `hack-local-variables-hook' be safe?
>> Define "safe".  I'm sure it'll cause problems in corner cases.
>> If those problems come down to the fact that `hack-local-variables-hook'
>> doesn't fit the bill, then we can look at fixing that.
> I was mostly asking if you are aware about any gotchas.

Not really, no.  I have no doubt that there are various (in addition to
the one you mention above).


        Stefan






  reply	other threads:[~2022-10-30  3:43 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
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 [this message]
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

  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=jwvmt9e6m3b.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=57003@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /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).