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: Fri, 17 Sep 2010 11:50:42 +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 1291874170 25845 80.91.229.12 (9 Dec 2010 05:56:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 05:56:10 +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 06:56:07 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 1PQZU5-0005x7-Q7 for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 06:56:05 +0100 Original-Received: from localhost ([127.0.0.1]:53793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQZU5-0008G8-0w for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 00:56:05 -0500 Original-Path: usenet.stanford.edu!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 23 Injection-Date: Fri, 17 Sep 2010 09:50:46 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="xDHsy1x9NE+TbkG1x7hofg"; logging-data="17251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RO2+G1EOwUgcltAJ9b1M6" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:2ES4+yTqK8dIyzaYYAFffu+nsrA= sha1:CjBtrlGvwwEq30wH5k1d466oSoA= Original-Xref: usenet.stanford.edu gnu.emacs.help:181350 comp.emacs:100508 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:76766 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. > 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