From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: command-separator char
Date: Tue, 23 Jun 2015 20:43:13 +0200 [thread overview]
Message-ID: <5589A8C1.5060707@easy-emacs.de> (raw)
In-Reply-To: <jwvk2uuz8hj.fsf-monnier+gnu.emacs.help@gnu.org>
Am 23.06.2015 um 19:00 schrieb Stefan Monnier:
>> Seems still no idea or definition what a sexp should be.
> Nope. It's only a UI issue.
>
> Sexp navigation is basically navigation within the AST, but a given
> buffer position corresponds to several different spots in the AST, so
> there's an ambiguity. Take your example line:
>
> echo "foo"; echo "asdf";
>
> the AST looks like
>
> echo
> /
> cmd
> / \
> / "foo"
> ;
> \ echo
> \ /
> cmd
> \
> "asdf"
Thanks a lot for your care!
> The position at BOL can be take to be right before the "echo" node, or
> right before the first "cmd" node or right before the toplevel composite
> instruction that comprises the whole line.
>
> You can mostly tell SMIE which one you want if you call smie-forward-sexp,
> by passing it a token explaining the level you care about.
>
> But forward-sexp is called by the user without any extra info, so it has
> to make an arbitrary choice. For compatibility with the usual
> forward-sexp semantics, the choice it makes is to consider the "deepest"
> position in the tree.
That would be plausible. Unfortunatly can't see that.
From end of first string jumps into second string. While there is an
expression of three minor expressions:
echo _ "foo"_ ;
WRT to deepest it should keep the level and end after ";"
> But as explained earlier, if you put point *before* a semi-colon, and then use
> M-C-f, then SMIE's forward-sexp will take this as a clue that you want
> to skip over whatever belongs to the right-hand of this semi-colon.
> So with point right after "foo", C-M-f will jump to right after "asdf".
>
> Along the same lines, you say:
>
> With cursor inside first string --> end of first string
>
> meaning that this is inconsistent,
No, didn't say that. That behaviour is expected - inconsistence was
shown by the relation of examples.
> but it's perfectly consistent, since
> forward-sexp does not jump to "the end of the currently enclosing
> entity" but instead to "the end of the entity that starts right after
> point".
>
> SMIE's forward-sexp could very well check syntax-ppss to see we're
> inside a string (or comment) and move outside of that string, but then
> it would be a different command.
>
IMHO a much more usefull one :)
> Stefan
>
>
> PS: That doesn't mean that it always works right either, of course.
> M-C-f with point right after the second "o" of "foo" (i.e. right before
> the closing double quotes) should signal an error
Think navigation shouldn't signal an error. Rather return nil - as at EOB.
> but will instead jump
> to right after the opening double quotes of "asdf".
> PPS: And `up-list' doesn't use SMIE quite right either.
IMO grammar oriented commands are needed - starting with token maybe.
Languages commonly know expressions, compositions of them - and so upwards.
Thanks,
Andreas
next prev parent reply other threads:[~2015-06-23 18:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5354.1434868275.904.help-gnu-emacs@gnu.org>
2015-06-21 17:29 ` command-separator char Stefan Monnier
2015-06-21 18:18 ` Andreas Röhler
[not found] ` <mailman.5381.1434910741.904.help-gnu-emacs@gnu.org>
2015-06-22 20:00 ` Stefan Monnier
2015-06-23 6:19 ` Andreas Röhler
[not found] ` <mailman.5482.1435040400.904.help-gnu-emacs@gnu.org>
2015-06-23 12:45 ` Stefan Monnier
2015-06-23 13:56 ` Andreas Röhler
[not found] ` <mailman.5495.1435067817.904.help-gnu-emacs@gnu.org>
2015-06-23 17:00 ` Stefan Monnier
2015-06-23 18:43 ` Andreas Röhler [this message]
[not found] ` <mailman.5516.1435085009.904.help-gnu-emacs@gnu.org>
2015-06-23 19:33 ` Stefan Monnier
2015-06-24 5:47 ` Andreas Röhler
[not found] ` <mailman.5548.1435124835.904.help-gnu-emacs@gnu.org>
2015-06-24 14:32 ` Stefan Monnier
2015-06-22 20:47 ` Emanuel Berg
2015-06-21 6:31 Andreas Röhler
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=5589A8C1.5060707@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--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.