[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Heuristics for: is a major-mode a "programming language" mode?
From: |
Stefan Monnier |
Subject: |
Re: Heuristics for: is a major-mode a "programming language" mode? |
Date: |
Wed, 08 Dec 2010 15:28:49 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>>>> So there must be some code which decides "which type" is the given
>>>> major mode. I would prefer the bulk of the decision to be made
>>>> programmatically, THEN let the user override if the auto-choice was
>>>> wrong. Anyone with ideas how to do this?
>> BTW, it occurred to me that maybe checking indent-line-function is
>> a good way to figure out whether the current mode is a programming mode.
> That's a cool idea! Now I need to check emacs v19-24 and see what is/was
> the default value for this. ;-)
I think that if you ignore indent-relative, indent-relative-maybe, and
indent-to-left-margin, (you can add (default-value
'indent-line-function) to the mix if you want) you'll catch the vast
majority of non-programming modes (at least under Emacs).
>> In theory we already have 2 commands to do that:
>> - indent-region (C-M-\): works well in practice, but limited to
>> re-indenting; i.e. it won't add/remove newlines.
> It will. At least in CPerl, if the user desires (configurable).
Thanks for the precision,
Stefan