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: Wed, 09 Apr 2014 08:41:45 -0400 Message-ID: References: <534482F2.6010504@dancol.org> <5344A698.6080201@dancol.org> <5344C898.7010904@dancol.org> <5344E90B.8080108@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1397047336 32239 80.91.229.3 (9 Apr 2014 12:42:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Apr 2014 12:42:16 +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 14:42:09 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 1WXrpQ-0001DP-Kw for ged-emacs-devel@m.gmane.org; Wed, 09 Apr 2014 14:42:08 +0200 Original-Received: from localhost ([::1]:45951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXrpQ-0002U5-7O for ged-emacs-devel@m.gmane.org; Wed, 09 Apr 2014 08:42:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXrpH-0002SC-2P for emacs-devel@gnu.org; Wed, 09 Apr 2014 08:42:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXrp9-0003jk-2N for emacs-devel@gnu.org; Wed, 09 Apr 2014 08:41:58 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:60266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXrp8-0003jK-SZ for emacs-devel@gnu.org; Wed, 09 Apr 2014 08:41:51 -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 s39Cfj9C000475; Wed, 9 Apr 2014 08:41:45 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 1FD16602DA; Wed, 9 Apr 2014 08:41:45 -0400 (EDT) In-Reply-To: <5344E90B.8080108@dancol.org> (Daniel Colascione's message of "Tue, 08 Apr 2014 23:30:35 -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 <707> : streams <1155103> : uri <1724680> 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:171362 Archived-At: >> 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