help-gnu-emacs
[Top][All Lists]
Advanced

[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:40 -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.

> there are 2 other thoughts similar to this... one is a desire to have
> a formatting command that works for any lang. e.g. you press a button,
> and the curren block, or region, or buffer, gets formatted, in any
> lang, to a user set preference. No longer the pains to align code or
> press tabs, per line. (there are tools for this in different lang...
> usually called something-lint.)

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.
- fill-region: in practice doesn't work at all.  In some major modes
  fill-paragraph will do what you want (or a variant of what you want,
  depending on your particular needs), but fill-region lacks hooks right
  now, so even the most careful major-mode writer won't be able to make
  it do the right thing.  There's a lot of room for improvement here.
  
> ... also, it's a fantasy of mine for C-h f to work in any lang. If
> info file doc for the lang doesn't exist, just send user to web
> browser of the lang's doc on that func.

The "info doc" part already exists: it's bound to C-h S.
It should be easy to make it able to use browse-url instead of Info.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]