help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: moving in js


From: Andreas Röhler
Subject: Re: moving in js
Date: Fri, 10 Aug 2012 08:45:19 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0

Am 10.08.2012 03:14, schrieb João Távora:
Single words and symbols also are not balanced expressions IMO.
When on ba|z

(foo (bar ba|z) quux)

C-M-b would reach |baz

(foo (bar |baz) quux)

i.e, it would do backward-word

No, it's doing backward-sexp. "baz" happens to also be a sexp (an
atomic), and it's not a question of opinion (see below).

a repeat would do backward-word again, a third would error

Can't see any relation to stipulated move over balanced expression here.

Looks fairly arbitrary.

It's not. In lisp-mode, where this is clearer (but as we have seen it
can and has been generalized to other programming modes), a word and a
symbol are also sexp's. See http://en.wikipedia.org/wiki/S-expression:

Thanks pointing at.

IMO we have a conflict of notion between "symbolic expression" and "balanced 
expression", the latter stated in Emacs lisp info.

An atom is an symbolic expression. But where is the balance in singularity 
established by atom? For a balance you need a counterpart.

a sexp can be an atom or a list ( a . b ) where a and b are themselves
sexp's. As you have found, backward-word doesn't error,  because it
doesn't care about sexp's. But backward-sexp does :-) , indeed it
*must* error to tell you there are no more sexp's backwards at that
level.


let's go on with a example from link given

"((milk juice) (honey marmalade))

is a two-element S-expression whose elements are also two-element S-expressions"

Go at beginning of honey and do backward-sexp --> error

A move command should look for a next element - preferably in same level.
But don't expect a kind of validation from, saying: oh, this list ends here.

It should just pick the next suitable element than.


IMO this is one of the best designed features in Emacs, and one many
non-Emacs users envy. When I move and delete with the C-M-* keys, I
get structured editing for free. And (shameless plug) if I add
autopair.el to that, I don't need paredit.el at all.  Furthermore,
because Emacs generalizes the sexp concept to other modes via
syntax-tables,  structured editing (and autopair) "just work" in
almost every programming mode that defines delimiters.

okay, a use-case is an argument
Will look there, maybe get a clue.



CC to help, as it might be of some interest for others to.

of course, I forgot to send my previous message to the list.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]