all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Heuristics for: is a major-mode a "programming language" mode?
Date: Wed, 15 Sep 2010 07:43:30 -0700 (PDT)	[thread overview]
Message-ID: <50407747-1f13-43c4-bb9a-ac53afdeca19@g6g2000pro.googlegroups.com> (raw)
In-Reply-To: slrni914er.deh.nospam-abuse@powdermilk.math.berkeley.edu

hi Ilya,

On Sep 15, 2:28 am, Ilya Zakharevich <nospam-ab...@ilyaz.org> 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.  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?

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.  In addition to sexp/sentence and function/paragraph, are there
>       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 “block”.

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.)

• 〈A Simple Lisp Code Formatter〉
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 ∑ xahlee.org ☄


  parent reply	other threads:[~2010-09-15 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15  9:28 Heuristics for: is a major-mode a "programming language" mode? Ilya Zakharevich
2010-09-15 13:12 ` Tim X
2010-09-15 14:27   ` Stefan Monnier
2010-09-15 14:43 ` Xah Lee [this message]
2010-09-15 15:08   ` Stefan Monnier
2010-09-15 15:32     ` Xah Lee
2010-09-15 23:22       ` Stefan Monnier
2010-09-16 23:43     ` Ilya Zakharevich
2010-09-17  9:50       ` Stefan Monnier
2010-09-16 23:40   ` Ilya Zakharevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50407747-1f13-43c4-bb9a-ac53afdeca19@g6g2000pro.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.