From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.devel Subject: Re: master e8acfc7: Add a command for string quotes toggling to ruby-mode Date: Tue, 9 Dec 2014 23:50:36 +0200 Message-ID: References: <20141209174508.29184.57986@vcs.savannah.gnu.org> <86k320v6kp.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="54876eac_5577f8e1_2c10" X-Trace: ger.gmane.org 1418161869 4064 80.91.229.3 (9 Dec 2014 21:51:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2014 21:51:09 +0000 (UTC) To: Dmitry Gutov , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 09 22:51:02 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 1XySgQ-0004NG-B0 for ged-emacs-devel@m.gmane.org; Tue, 09 Dec 2014 22:51:02 +0100 Original-Received: from localhost ([::1]:42615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XySgP-0002Bq-T3 for ged-emacs-devel@m.gmane.org; Tue, 09 Dec 2014 16:51:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XySg8-0002Bl-G5 for emacs-devel@gnu.org; Tue, 09 Dec 2014 16:50:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XySg2-0007IS-Eq for emacs-devel@gnu.org; Tue, 09 Dec 2014 16:50:44 -0500 Original-Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:47562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XySg2-0007IG-2L for emacs-devel@gnu.org; Tue, 09 Dec 2014 16:50:38 -0500 Original-Received: by mail-wg0-f45.google.com with SMTP id b13so2056001wgh.4 for ; Tue, 09 Dec 2014 13:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type; bh=DpSWcT+kMwA2ian8Y/TSh1v4aBq4Lav1vXxAaq8ABrU=; b=go1d/I2adWwcietLu5mc5oVvwwMghMYikuYHFPY3Fwb2PV8DZWWoRZ4lZ8dytaavLc G2Qoe5VLTQetdVIa4GBQjfcCzETaET9qNYbyKw9j08def3+AxBEWDb1V0zcbFZaQozqP c1xFN99legesNszqDLL06+DyzDRaptrdH3CmrryaOJqhdrVXFdfnD6q7gQ/rRarWDmqh bWmEBy7+LEOTUKGC2bKEtpRURw6jI1oPPx10WNavNDXY1gg/Ys5fisBZ7C3ffWwyjnEJ agPF2SIeoeYeCpdCQsZOBtdEJ0I+KBXYotdhCVHYNiolPxNy0RCnRhKys4RMBFthW3dD Hjsw== X-Received: by 10.194.179.166 with SMTP id dh6mr717298wjc.87.1418161836976; Tue, 09 Dec 2014 13:50:36 -0800 (PST) Original-Received: from bozhidar-mini.local ([93.123.71.105]) by mx.google.com with ESMTPSA id w10sm3399239wje.10.2014.12.09.13.50.35 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 13:50:36 -0800 (PST) In-Reply-To: <86k320v6kp.fsf@yandex.ru> X-Mailer: Airmail (249) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22d 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:179597 Archived-At: --54876eac_5577f8e1_2c10 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I was thinking it might cause problems for strings that are not quoted li= terals. I might be wrong, though. =E2=80=94=C2=A0 Cheers, Bozhidar On December 9, 2014 at 23:47:37, Dmitry Gutov (dgutov=40yandex.ru) wrote:= Hi=21 =20 Bozhidar Batsov writes: =20 > +(defun ruby--string-region () =20 > + =22Return region for string at point.=22 =20 > + (let ((orig-point (point)) (regex =22'=5C=5C(=5C=5C(=5C=5C=5C=5C'=5C=5C= )=5C=5C=7C=5B=5E'=5D=5C=5C)*'=5C=5C=7C=5C=22=5C=5C(=5C=5C(=5C=5C=5C=5C=5C= =22=5C=5C)=5C=5C=7C=5B=5E=5C=22=5D=5C=5C)*=5C=22=22) beg end) =20 > + (save-excursion =20 > + (goto-char (line-beginning-position)) =20 > + (while (and (re-search-forward regex (line-end-position) t) (not (and= beg end))) =20 > + (let ((match-beg (match-beginning 0)) (match-end (match-end 0))) =20 > + (when (and =20 > + (> orig-point match-beg) =20 > + (< orig-point match-end)) =20 > + (setq beg match-beg) =20 > + (setq end match-end)))) =20 > + (and beg end (list beg end))))) =20 Any reason this doesn't do something like =20 (let ((state (syntax-ppss))) =20 (when (memq (nth 3 state) '(=3F' =3F=5C=22)) =20 (goto-char (nth 8 state)) =20 (forward-sexp) =20 (list (nth 8 state) (point)))) =20 =3F =20 --54876eac_5577f8e1_2c10 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline