[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: make up-list escape strings
From: |
Stefan Monnier |
Subject: |
Re: Proposal: make up-list escape strings |
Date: |
Wed, 09 Apr 2014 08:41:45 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
>> 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
- 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, 2014/04/09
- Re: Proposal: make up-list escape strings, Daniel Colascione, 2014/04/09
- Re: Proposal: make up-list escape strings,
Stefan Monnier <=
- 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