all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Tom Tromey <tom@tromey.com>
Cc: 10460@debbugs.gnu.org, Leo <sdl.web@gmail.com>
Subject: bug#10460: 24.0.92; css-mode sexp movement
Date: Mon, 29 Dec 2014 14:13:55 -0500	[thread overview]
Message-ID: <jwv387ycm4h.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <877fxav2ft.fsf@tromey.com> (Tom Tromey's message of "Mon, 29 Dec 2014 09:35:50 -0700")

> I suppose this supplies a bit of wiggle room, if you leniently interpret
> "prefix characters".

SMIE interprets "balanced expression" as "a subnode in the AST".

It can surprise at the beginning, indeed, but in my experience, it's
a useful generalization for languages with infix syntax.

Of course, for infix languages, "a + b * c" might be a proper AST
subnode (whereas stopping after "a + b" wouldn't if there's a "* c"
afterwards), but so is "a", when using forward-sexp we have to choose at
which level of the AST we want to jump forward.  In the above case SMIE
will choose "a" over "a + b * c" (i.e. it will choose the
smallest/deepest subnode).

But when faced with "+ b * c", there is simply no proper subnode ahead.
Here, SMIE extends yet again the concept of "balanced expression" in
order to be able to do something meaningful: it jumps over the whole "+
b * c" (i.e. over the infix op plus its right argument).  This is very
handy in languages with few parentheses, letting you advance by "large"
logical units, just like you would in Lisp where every top-level
statement is wrapped inside parentheses.


        Stefan





  reply	other threads:[~2014-12-29 19:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09  1:40 bug#10460: 24.0.92; css-mode sexp movement Leo
2012-01-09  9:45 ` Deniz Dogan
2012-01-17  4:43   ` Leo
2014-12-29  3:53 ` Tom Tromey
2014-12-29 14:50   ` Stefan Monnier
2014-12-29 16:35     ` Tom Tromey
2014-12-29 19:13       ` Stefan Monnier [this message]
2014-12-29 19:20         ` Tom Tromey
2014-12-30  2:46           ` Stefan Monnier
2014-12-30 19:15             ` Tom Tromey
2014-12-30 23:03               ` Stefan Monnier

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=jwv387ycm4h.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=10460@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    --cc=tom@tromey.com \
    /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.