From: Daniel Colascione <dancol@dancol.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Proposal: make up-list escape strings
Date: Tue, 08 Apr 2014 21:12:08 -0700 [thread overview]
Message-ID: <5344C898.7010904@dancol.org> (raw)
In-Reply-To: <jwvtxa3xim9.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1680 bytes --]
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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
next prev parent reply other threads:[~2014-04-09 4:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 23:14 Proposal: make up-list escape strings Daniel Colascione
2014-04-09 1:11 ` Stefan Monnier
2014-04-09 1:47 ` Daniel Colascione
2014-04-09 3:54 ` Stefan Monnier
2014-04-09 3:56 ` Stefan Monnier
2014-04-09 4:12 ` Daniel Colascione [this message]
2014-04-09 6:30 ` Daniel Colascione
2014-04-09 12:41 ` Stefan Monnier
2014-04-09 16:09 ` Daniel Colascione
2014-04-09 6:17 ` 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=5344C898.7010904@dancol.org \
--to=dancol@dancol.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.