[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: make up-list escape strings
From: |
Daniel Colascione |
Subject: |
Re: Proposal: make up-list escape strings |
Date: |
Tue, 08 Apr 2014 21:12:08 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/08/2014 08:56 PM, Stefan Monnier wrote:
>>> Why limit this to strings? It makes just as much sense to do it for
>>> comments, doesn't it?
>> It's a bit harder to implement for comments (as in, rewrite up-list
>> using parse-partial-sexp), and I'm not sure it's as useful. Probably not
>> too bad though.
>
> I don't follow you. It doesn't seem hard: just use forward-comment to
> skip over the comment instead of forward-sexp to skip over the string.
> Otherwise, the code should be pretty much identical for comments as
> for strings.
Right now, the main case is based on scan-lists. Say we have something
like this JavaScript code:
[ 1, 2, /* NO: [ 3.1, 3.3, 3.3 ] */ 3, 4 ]
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
If I understand what you mean by "do it for comments", if point begins
at `D' (well, between `C' and `D'), up-list should take us to `p', then
`i', then `a'. The problem is that `scan-lists' called with FROM `p',
COUNT -1, and DEPTH 1 will move directly from `p' to `a', bypassing
position `i'. We're going to need fancier logic to make that work correctly.
Anyway, even if you did stop at position `i', you couldn't do much: you
can't manipulate that comment as a sexp. The use case that motivated my
change is quickly replacing the string that happens to contain point,
like vim can with `di"' command. Since we don't have any commands that
manipulate comments as first-class lexical objects, making up-list stop
on comments seems less useful to me. I'd rather just treat comments as
pseudo-whitespace like the rest of Emacs does.
It'd be nice to treat comments as sexps, but that change is out of scope.
signature.asc
Description: OpenPGP digital signature
- Proposal: make up-list escape strings, Daniel Colascione, 2014/04/08
- Re: Proposal: make up-list escape strings, Stefan Monnier, 2014/04/08
- Re: Proposal: make up-list escape strings, Daniel Colascione, 2014/04/08
- Re: Proposal: make up-list escape strings, Stefan Monnier, 2014/04/08
- Re: Proposal: make up-list escape strings, Stefan Monnier, 2014/04/08
- Re: Proposal: make up-list escape strings,
Daniel Colascione <=
- Re: Proposal: make up-list escape strings, Daniel Colascione, 2014/04/09
- Re: Proposal: make up-list escape strings, Stefan Monnier, 2014/04/09
- Re: Proposal: make up-list escape strings, Daniel Colascione, 2014/04/09
Re: Proposal: make up-list escape strings, Andreas Röhler, 2014/04/09