From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Daniel Colascione <dancol@dancol.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Proposal: make up-list escape strings
Date: Wed, 09 Apr 2014 08:41:45 -0400 [thread overview]
Message-ID: <jwveh16y9an.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5344E90B.8080108@dancol.org> (Daniel Colascione's message of "Tue, 08 Apr 2014 23:30:35 -0700")
>> 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'.
Right.
>> 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'.
Not if you narrow to the comment before.
>> We're going to need fancier logic to make that work correctly.
No, you already have the logic for strings.
>> Anyway, even if you did stop at position `i', you couldn't do much: you
>> can't manipulate that comment as a sexp.
Good point. It would call for things like mark-sexp to handle comments
not as white space. But part of the reason is to avoid comment-crossing
and things like that, e.g. with
x = '('; // That's comment.
If you start from the end of line (and assume a no-string-crossing
behavior), you don't want C-M-u to jump just before the open paren.
> + (when no-string-crossing
> + (let ((syntax (syntax-ppss)))
> + (when (nth 3 syntax) ; Inside string
^
8
> + (save-excursion
> + (goto-char (nth 8 syntax)) ; String start
> + (narrow-to-region
> + (point)
> + (condition-case nil
> + (progn (forward-sexp) (point))
^^^^^^^^^^^^^^
use (forward-comment) if (nth 4 syntax)
But then no-string-crossing needs to be renamed maybe "no lexical crossing"?
Other than that, looks good, feel free to install.
Stefan
next prev parent reply other threads:[~2014-04-09 12:41 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
2014-04-09 6:30 ` Daniel Colascione
2014-04-09 12:41 ` Stefan Monnier [this message]
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=jwveh16y9an.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=dancol@dancol.org \
--cc=emacs-devel@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.