From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Proposal: make up-list escape strings Date: Tue, 08 Apr 2014 21:11:50 -0400 Message-ID: References: <534482F2.6010504@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1397005947 1765 80.91.229.3 (9 Apr 2014 01:12:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Apr 2014 01:12:27 +0000 (UTC) Cc: Emacs developers To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 09 03:12:19 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WXh3q-00074o-FE for ged-emacs-devel@m.gmane.org; Wed, 09 Apr 2014 03:12:18 +0200 Original-Received: from localhost ([::1]:43711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXh3p-00018U-WD for ged-emacs-devel@m.gmane.org; Tue, 08 Apr 2014 21:12:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXh3f-00011B-VQ for emacs-devel@gnu.org; Tue, 08 Apr 2014 21:12:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXh3W-0007Jq-JU for emacs-devel@gnu.org; Tue, 08 Apr 2014 21:12:07 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXh3W-0007IO-Dd for emacs-devel@gnu.org; Tue, 08 Apr 2014 21:11:58 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s391Bpvl030890; Tue, 8 Apr 2014 21:11:51 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id E9DE06020E; Tue, 8 Apr 2014 21:11:50 -0400 (EDT) In-Reply-To: <534482F2.6010504@dancol.org> (Daniel Colascione's message of "Tue, 08 Apr 2014 16:14:58 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4906=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4906> : inlines <704> : streams <1154673> : uri <1724244> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:171353 Archived-At: > 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