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 07:43:30 -0700 (PDT) Organization: http://groups.google.com Message-ID: <50407747-1f13-43c4-bb9a-ac53afdeca19@g6g2000pro.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291864209 25266 80.91.229.12 (9 Dec 2010 03:10:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 03:10:09 +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 04:10:06 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 1PQWtP-0001qy-Oo for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 04:10:03 +0100 Original-Received: from localhost ([127.0.0.1]:53836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQWkK-0005r5-1m for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 22:00:40 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!g6g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 49 Original-NNTP-Posting-Host: 67.180.85.8 Original-X-Trace: posting.google.com 1284561810 20656 127.0.0.1 (15 Sep 2010 14:43:30 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 15 Sep 2010 14:43:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g6g2000pro.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:181327 comp.emacs:100502 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:76513 Archived-At: hi Ilya, On Sep 15, 2:28=C2=A0am, Ilya Zakharevich wrote: > I want a certain keypress act as forward-sexp in "programming > language" modes, and as forward-sentence (sp?) in other modes > (likewise for go-to-function-begin (sp?) and forward-paragraph (sp?)). > > So there must be some code which decides "which type" is the given > major mode. =C2=A0I would prefer the bulk of the decision to be made > programmatically, THEN let the user override if the auto-choice was > wrong. =C2=A0Anyone with ideas how to do this? a fool's answer: wouldn't just search for all the [] and {} heuristic works pretty much? most top 10 langs follow c-like syntax, so am guessing checking some () {} would work out... > P.S. =C2=A0In addition to sexp/sentence and function/paragraph, are there > =C2=A0 =C2=A0 =C2=A0 other "merges" one can do to do navigation? i have similar need... i don't like forward/backward-paragraph in programing mode. Their behavior is unpredictable. I instead defined forward/backward-block, which is delimited by 2 empty lines. So, when i use the key, i'm sure to land on the next/prev =E2=80=9Cblock=E2=80=9D. 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.) =E2=80=A2 =E3=80=88A Simple Lisp Code Formatter=E3=80=89 http://xahlee.org/emacs/lisp_formatter.html ... 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. Wrote up more here http://xahlee.org/emacs/emacs_lookup_ref.html i guess the idea is than many nice things in emacs-lisp-mode can be brought out to all langs, at least the top 10 major langs. currently, i think each lang mode may implement some of this feature, but the keybinding is different, behavior is different, degree of support is different... Xah =E2=88=91 xahlee.org =E2=98=84