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

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

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

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

I disagree of course, but I will try not to belabor the point.

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

I noticed this asymmetry and was going to bring it up in this reply.
Now you've foiled my riposte.

What I mean is that, in the example in this bug, if you do
backward-sexp, then forward-sexp just advances over the "a" and not the
braced pair.

However, this asymmetry does seem less regular, and IMO therefore less
useful, than a simpler lexically-based movement scheme.  Also conformity
with other modes is a distinct plus -- I necessarily touch code in many
languages, and it slows me down when one mode or another violates my
expectations.

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

It's handy to have movement commands that means "symbol or balanced
paren-like things".  I always thought that was *-sexp.

Tom





  reply	other threads:[~2014-12-29 19:20 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
2014-12-29 19:20         ` Tom Tromey [this message]
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=87387yuusm.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=10460@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sdl.web@gmail.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.