From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Heuristics for: is a major-mode a "programming language" mode? Date: Wed, 15 Sep 2010 17:08:18 +0200 Organization: A noiseless patient Spider Message-ID: References: <50407747-1f13-43c4-bb9a-ac53afdeca19@g6g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1291869657 10998 80.91.229.12 (9 Dec 2010 04:40:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 04:40:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 05:40:53 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQYJH-0007Rm-Un for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 05:40:52 +0100 Original-Received: from localhost ([127.0.0.1]:53011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQYJH-0000JG-4o for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 23:40:51 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!xlned.com!feeder3.xlned.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 33 Injection-Date: Wed, 15 Sep 2010 15:08:23 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="xDHsy1x9NE+TbkG1x7hofg"; logging-data="10512"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eokh0tsAIUsG/RYrSqs/L" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:TuFfrb3p8FMtC/rgPtdIgJxmu5Y= sha1:XsR8EZzCwglHcp0v/HoEBVp16BA= Original-Xref: usenet.stanford.edu gnu.emacs.help:181328 comp.emacs:100503 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76665 Archived-At: >> 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