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 12:21:53 -0500 Message-ID: <56E1AD31.3@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> <56E18CB0.4040203@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v01NHF849qspLr2xuWj7gGwWW51KPWGaI" X-Trace: ger.gmane.org 1457630540 13451 80.91.229.3 (10 Mar 2016 17:22:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2016 17:22:20 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 10 18:22:09 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 1ae4Hm-0005za-Pq for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2016 18:22:07 +0100 Original-Received: from localhost ([::1]:50068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae4Hm-0007aN-4J for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2016 12:22:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae4Hh-0007a8-SJ for emacs-devel@gnu.org; Thu, 10 Mar 2016 12:22:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ae4Hc-0007Kh-T4 for emacs-devel@gnu.org; Thu, 10 Mar 2016 12:22:01 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.133]:62683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae4Hc-0007K7-JC for emacs-devel@gnu.org; Thu, 10 Mar 2016 12:21:56 -0500 Original-Received: from [18.189.75.34] ([18.189.75.34]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0Lq1p2-1a99NL1K1A-00dkKh for ; Thu, 10 Mar 2016 18:21:55 +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:OpC0golufZYpDLN5a0E+TzmhsG7a225ErH3Ho24OJHXuPmKzzxr UwQG47nqXd5DrEhZ9K3EzL+KU9LoYqkbKxn9tdeuKQKKo1D5ElYIXVZmo5ZLmsn9B9U6F6e 7BUSvyV6A0Up/jpxx2ItgxL16B7+yCTEg9qtqQomPJ9clrtGYdC3oS9nH2TyiimUOinP+sh Yhw905tiu4OTosjIvArVA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Dae4EEvqU90=:sSVBQO23ooWWMKZfdUM7m1 Kbh924RPLENKOien6qNlXe1goaWfWEXwlvLDyNXvrSvQnprN2l6fYNpo3EDw4ssSDkw/9F0tf 93qAKYGWwIlussX0v8mqM4jWa1AUMyDtoKJ773Z/1w5S8l7rmSzi0EZrm1N+atrFkfzUsxh0u 9eXvj9wvfa1lh7gKh7GtePhdDmCs4EOHAdACCZge0V88SXd18z3Vn6QaWq8M7SUJ1H2Bnm9fd yLgXPnl2ZO3p8W8CPfFvKIZVOFZ03ihQEiSjb2yVs0jPqzDR2Gf8ZwfmuXnaDiI6oC1hq+Cfg Y9uYg0gq9X8O4+bBOlebDeMsvPs2+SITTTlrH5HVAstp1bHUnJcVX7xY/6MyyGqMvY+YxPe/3 D5Tcm0k1eCO6HS+sZ5o58y6anfbBILqu2WCM/viYmg1wwshrtYL8JHyokVg7Uf+wqfphTTv2B HPS+E0SZ822uYGzWQ3zdH0JLnF/7TOdnWkyi4FPHIAJIWXfMO1OXYbhf053qvhL7atEgF7lKQ UR6nmG1jTUweAhSLC+4V579KjZ+GUdb849Qgs7eMNLGsEt7kI9wIZyZvs3QHM+fZg53iLVPCB z4L2r6Lub/PwpjFwmSNtTQvc4UR+SJoeDrkJ6PxDoCI4bjTNtcGhBHF3QqlsF/L0tsBjQ5BPf lpfrHmj6k2iFh6IcLBDukjTjZyAq+UgBx466DpNZFgtRI4aX55vy9Lq9BWVBQM6ekKSI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 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:201407 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --v01NHF849qspLr2xuWj7gGwWW51KPWGaI Content-Type: multipart/mixed; boundary="mX6CcSLn9Q5Dgb5NHGrmUa1VAQXM2m3pW" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <56E1AD31.3@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> <56E18CB0.4040203@gmail.com> In-Reply-To: --mX6CcSLn9Q5Dgb5NHGrmUa1VAQXM2m3pW Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 03/10/2016 10:20 AM, Stefan Monnier wrote: >> Thanks for the clarification. What's the recommended way to check if t= he >> point is in a comment, then? I'm thinking for example of adjusting >> fill-nobreak-predicate, or similar things. >=20 > The recommended way is >=20 > (nth 8 (syntax-ppss)) >=20 > Whether "/*" is inside the comment or not is very debatable, and= > luckily it rarely matters. So if/when it matters and syntax-ppss's > answer isn't the one we need, then we can discuss the better replacemen= t > for that specific case, but the specifics will matter then. Cool, thanks Stefan, As long as this behaviour is consistent with the res= t of Emacs, that's fine by me. Here's one case where it matters: in tuareg-mode (for OCaml), with the fo= llowing code: (* comment *) The call to (prettify-symbols-default-compose-p (point) (1+ (point)) nil)= returns t. On the other hand, the same call with the point as follows returns nil: (* comment *) This makes it unreliable to prettify * to =D7 in tuareg mode. I'll report a bug for prettify-symbols-mode. Cl=E9ment. --mX6CcSLn9Q5Dgb5NHGrmUa1VAQXM2m3pW-- --v01NHF849qspLr2xuWj7gGwWW51KPWGaI 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) iQIcBAEBAgAGBQJW4a0xAAoJEPqg+cTm90wjYiYP/iz+vckU1acMonlc9cZJBk0r u4yXJsMCEdOHnnkt2t1UyTPCsRZProdTKZ8Ig0YGF36dLL7g+42wldP3jY6y+EIX Hx/r9bRk9TyeQs6bxfn56R0QpwNCrCzfeMeM0bbBF+wB5YdYAGgG7BA9b/r2+GcC 6VD9HLKhZ2NYy5Vblir5z+lWMhOnVD3p4W4A2OKe5Kg6gzFO7L5hRKspYqci3Wq5 YJhe3Y4CygfQnSlMpGckFkXTgahX2HLB+o1VX/ZRL92//29nAsxocjEvwEPKkQFc sCxG+U3+qQj+76fNIFlqyChfR7kjqSdhuCWGHq49VGa3huwBuXw/FNSgl7+HFp0K cahe0DVckjvi8HStR/oAMPjVBIWTsUb2AEhTZ9iceLAUCdLUhCWBDYaU2eq4STo9 n0d0NanOh61ytVO1nWlyjH7ANnRqDLbUpTMFayYiKLUPYIaJ4MXUHsghk0fpwOKM mZs84dLcsh6TQ6tSeRIIT2KNXI4DY2unGQfQjT+W+EY5FbDj0kAvsuONuT76vayi jqVoAG/zOASxYXLxy3qws3h1Rw/0mIq4QrTT/1/rEA/uhJoe2vh1q7GbZaZhu59e II23ZCv3PNVyQB63vSs48DZf4gzNDjsNf3bQjlAJzdrBDhPmO4VSpspAzDsGr1Ql jFuzJLoRpjiygD8A5K3p =vv1u -----END PGP SIGNATURE----- --v01NHF849qspLr2xuWj7gGwWW51KPWGaI--