From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: How do you check if the current point is in a comment or a string? (Was Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]) Date: Thu, 10 Mar 2016 10:03:12 -0500 Message-ID: <56E18CB0.4040203@gmail.com> References: <20160308132530.861.91488@vcs.savannah.gnu.org> <20160308183010.GB6269@acm.fritz.box> <20160308200753.GC6269@acm.fritz.box> <20160309104900.GA3948@acm.fritz.box> <56E05831.9070900@gmail.com> <56E063C9.4080203@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pLdN0Ro4Cc8tKI5Win8R9vVEHbmebjcEh" X-Trace: ger.gmane.org 1457622233 32605 80.91.229.3 (10 Mar 2016 15:03:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2016 15:03:53 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 10 16:03:44 2016 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 1ae27p-0006Dt-Ca for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2016 16:03:41 +0100 Original-Received: from localhost ([::1]:49016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae27o-000433-RE for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2016 10:03:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae27V-00042J-Su for emacs-devel@gnu.org; Thu, 10 Mar 2016 10:03:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ae27P-0004dp-Uj for emacs-devel@gnu.org; Thu, 10 Mar 2016 10:03:21 -0500 Original-Received: from mout.kundenserver.de ([212.227.17.24]:50317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae27P-0004dg-LT for emacs-devel@gnu.org; Thu, 10 Mar 2016 10:03:15 -0500 Original-Received: from [18.189.75.34] ([18.189.75.34]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0M1o1y-1ZpuXY2mwE-00tmjE for ; Thu, 10 Mar 2016 16:03:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: X-Provags-ID: V03:K0:VTJZA9pQD5cveOENbXS1KQ9uCiYb5XkwAXO5m8aMA4ryva4eN72 mRTywJ1NXxqV5oZHryjklgeZrJvVbyC759trlX4mBDPnPmvdPAttQIKScFQbds7ZJ5Jd6b7 7hb9zVTtlU4WwmI3J2zrPjqYaXF6YonwmlFN7KgQut7+QS/4qWIZ8ivJ4LqL4+W2Nl+7eAk 650FquDPYp+RpDPoE+izw== X-UI-Out-Filterresults: notjunk:1;V01:K0:AmiAmdjKEoc=:D8IQbuBBQov4EgHag7pLOn 0xokQkP9ZXXieYWn2ScY9wPHg1OmCTWjKJ0ojxZ4r1BNFxQ4NSOGX0yd1+tQB54sLZEJL/FUz ApaIbRPwzwz7jWDgdZXJRQK4lEGVvvlzwoxqEr2uXhquncTEJ/ScaMo2750heT/XPTnB0+9Bp kWTD+aZrRk2ifFXYbSw4cKFDw8FM6tTkNF3buBwr7hcREoZRZzYS2SwFRIOIvAxtCOXO1RudI 44AehMM9ui2uD3DY1WBjn+1XOpDXT3SMKAeyrR1KCu7YCNDj3la32628/NnYHEkI7vqJKSW99 KjtdGZGhZmSU6oNeYfBUDu0c8VZ2ci/0/ewXnoAma6q8sLoPLBiRgS+qMH55Chb4jekXXAeNx rFhd1qTa/30KQI6/WDm5q5o0QMT4+hidoC/AKMPwq/fKjVsiPyjWnuPv7VlYas/nbyrx3Bse3 vRhVrSGYoOFt54C+Z5Xqos2M3Vd9wYnM4W7uVDUoliQY8hqjhR/2QVoU/M8PwX0+h4qGnTyHO zVdFpqYFBPU08JozJwVWvglYNi3tFIK6/r8kropv3LKDgAb13er3s8/HDWVayB50sFLBj8Odp wfEADcmPfvjcTzNT32gDAMUNWAJpe5EwqzeRynBK2O8/j38PBLqcgkELbsc2SiSzsCm14XXpl /gutWun7PZccpYyhUQBJmSkhOViEeaRVVXMUMX7gfFhNok0+ewbM9p+t/6+QoV/UAXX4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 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:201389 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pLdN0Ro4Cc8tKI5Win8R9vVEHbmebjcEh Content-Type: multipart/mixed; boundary="c8N2HpEuWfEaE6sLUchV8dilOwtTCLoNS" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <56E18CB0.4040203@gmail.com> Subject: Re: How do you check if the current point is in a comment or a string? (Was Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]) References: <20160308132530.861.91488@vcs.savannah.gnu.org> <20160308183010.GB6269@acm.fritz.box> <20160308200753.GC6269@acm.fritz.box> <20160309104900.GA3948@acm.fritz.box> <56E05831.9070900@gmail.com> <56E063C9.4080203@gmail.com> In-Reply-To: --c8N2HpEuWfEaE6sLUchV8dilOwtTCLoNS Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 03/10/2016 09:28 AM, Stefan Monnier wrote: >>> (nth 8 (syntax-ppss)) works fine for me in something like ";; some >>> comment in an emacs-lisp-mode buffer"; it returns the starting point >>> of the comment. >> Does it really? For me it returns nil when the point is as shown below= : >> ;; some comment in an emacs-lisp-mode buffer >=20 > That's correct, because point is *not* inside the comment. >=20 >> In all these cases, the font trick works. >=20 > Here it's because `get-text-property' returns the property of the > character after point, and indeed this is ";" which is in the comment. >=20 > IOW they're both correct because they don't ask the same thing. >=20 >> In C mode, it returns nil in the following two positions: >> >> // asd >> // asd >> >> As well as these two: >> >> /* asd */ >> /* asd */ >=20 > Indeed, this is a current problem with parse-partial-sexp (and hence > syntax-ppss) and is directly related to what Alan was referring to. >=20 > Given the way parse-partial-sexp works (i.e. it can only look at the > text that precedes), even if we fix it, parse-partial-sexp wouldn't be > able to tell you that is inside a comment. But it could tell > you that it's in the middle of something that could turn out to be > a comment. Thanks for the clarification. What's the recommended way to check if the = point is in a comment, then? I'm thinking for example of adjusting fill-n= obreak-predicate, or similar things. --c8N2HpEuWfEaE6sLUchV8dilOwtTCLoNS-- --pLdN0Ro4Cc8tKI5Win8R9vVEHbmebjcEh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJW4YywAAoJEPqg+cTm90wjO7EP/iIeuT6WdT7v/FAaUDhQPSrD u4T1fhQCcSCMSe7whT2tsQoNE5Pn0FEmIUeWIRjZIepjYRV2C5CEOboov3BbjWms 2zCF8PMJMGfAHF8/5hsAjGxtF88IKi/OyH03NJjOurGW5sc7opoVa9jALdqxbayx gBysQRCJMNmgALy8a1jCk+jPif/e9A/9ZooLhzJezTHtPO0tC26ip/bXgoAu/x/G L1K1c12BUWECjTYHyQnPqMHSGXq1MK6090L0doeiVTwVBO2JiV0v8pdtB2kdjDbv OV3hSlQNi5on+CWGrgLgiCVN6ivZkt6vcjJUwT7L0saWEcCaXupdOmeyv89jpr4P j0OWtlEuZ6+yW6spmv1LFPH/oT6m+7zECiydD4OmCdWGj3v+G6h89YDVU09uFfy8 +JStbOt02wk7w9Elyacipl03sRofK53qqYw57IXo8JR/HuEMTrOn7+IWM7BUKYsw AlRy0d0bX7GsOfMnKgMSzK/kPgy1WEyIcjn1p5gyCsT/38ZYshzcJI9HX1U8zg/f b102zLAmaeESgLUJnDhyVMATtGCjD4MZ6T+n3bZ8h/uYOXNxpjoYRE4hL6LYzQgb sdSMHhjSa0v/aEeYpLv8yDtldaTV5C79FsfRkUuVG+tYW4cQ+vJoDl1cbsIB2jAx WuhEyDUFDOoQXFQZMEKK =OHun -----END PGP SIGNATURE----- --pLdN0Ro4Cc8tKI5Win8R9vVEHbmebjcEh--