unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
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: Tue, 08 Apr 2014 21:11:50 -0400	[thread overview]
Message-ID: <jwv61mjz4xi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <534482F2.6010504@dancol.org> (Daniel Colascione's message of "Tue, 08 Apr 2014 16:14:58 -0700")

> Here's a small patch that makes backward-up-list and up-list escape
> strings as well as explicit lists. This behavior is active only when
> these functions are called interactively or when lisp explicitly asks
> for this behavior, so the change shouldn't pose a compatibility risk.
> Backing out of strings is generally a useful thing to do when you want
> to operate on the string as a whole.

Thanks, this is long overdue.  See comments below:

> +If ESCAPE-STRINGS is non-nil (as it is interactively), treat
> +encoding strings as sexps."
   ^^^^^^^^
   enclosing, right?  ;-)

Why limit this to strings?  It makes just as much sense to do it for
comments, doesn't it?

>      (while (/= arg 0)
>        (if (null forward-sexp-function)
> -          (goto-char (or (scan-lists (point) inc 1) (buffer-end arg)))
> +          (condition-case err
> +              (goto-char (or (scan-lists (point) inc 1) (buffer-end arg)))
> +            (scan-error
> +             (or (and escape-strings
> +                      (let ((syntax (syntax-ppss)))
> +                        (and (nth 3 syntax)
> +                             (nth 8 syntax))
> +                        (goto-char (nth 8 syntax))
> +                        (when (> arg 0) (forward-sexp))
> +                        t))
> +                 (signal (car err) (cdr err)))))

If @ is point, I think that from

      (a "b (c (d @ e) " "f) g" h)

up-list should move to

      (a "b (c (d e)@ " "f) g" h)

and then to

      (a "b (c (d e) "@ "f) g" h)

whereas I think your code would move to

      (a "b (c (d e) " "f)@ g" h)

> +            (or (and escape-strings
> +                     (let ((syntax (syntax-ppss)))
> +                       (and (nth 3 syntax)
> +                            (nth 8 syntax))
> +                       (goto-char (nth 8 syntax))
> +                       (when (> arg 0) (forward-sexp))
> +                       t))

This should be factored out into a separate function to avoid the
code duplication.


        Stefan



  reply	other threads:[~2014-04-09  1:11 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv61mjz4xi.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).