From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Heuristics for: is a major-mode a "programming language" mode? Date: Wed, 15 Sep 2010 08:32:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <084e458d-2de1-4377-9744-1af0044d7529@i4g2000prf.googlegroups.com> 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: quoted-printable X-Trace: dough.gmane.org 1291873500 23834 80.91.229.12 (9 Dec 2010 05:45:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 05:45:00 +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:44:57 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 1PQZJI-0002op-41 for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 06:44:56 +0100 Original-Received: from localhost ([127.0.0.1]:53322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQZJG-00057P-UM for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 00:44:55 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!i4g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 43 Original-NNTP-Posting-Host: 67.180.85.8 Original-X-Trace: posting.google.com 1284564770 30316 127.0.0.1 (15 Sep 2010 15:32:50 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 15 Sep 2010 15:32:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i4g2000prf.googlegroups.com; posting-host=67.180.85.8; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3, gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:181329 comp.emacs:100504 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:76755 Archived-At: On Sep 15, 8:08=A0am, Stefan Monnier wrote: > >> So there must be some code which decides "which type" is the given > >> major mode. =A0I would prefer the bulk of the decision to be made > >> programmatically, THEN let the user override if the auto-choice was > >> wrong. =A0Anyone 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 > =A0 re-indenting; i.e. it won't add/remove newlines. > - fill-region: in practice doesn't work at all. =A0In some major modes > =A0 fill-paragraph will do what you want (or a variant of what you want, > =A0 depending on your particular needs), but fill-region lacks hooks righ= t > =A0 now, so even the most careful major-mode writer won't be able to make > =A0 it do the right thing. =A0There's a lot of room for improvement here. nice info. Yeah i use them... experience just as you described. > > ... 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. haven't used this before. When i tried to do that in perl or python mode, the mini-buffer seems to try to search the info doc but couldn't find it.... am wondering to what extent it is currently being used in practice. Does anyone reading here use this daily? Xah