From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.bugs Subject: bug#23461: perl-mode: Displaying HERE-docs as strings instead of comments [PATCH] Date: Thu, 24 Dec 2020 16:29:37 +0100 Message-ID: <87r1nfkyse.fsf@hajtower> References: <87sg7xxo0s.fsf@hajtower> <87zh24611c.fsf@hajtower> <87r1ng5pj8.fsf@hajtower> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10743"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 23461@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 24 16:30:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksSZ9-0002ex-QC for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 16:30:11 +0100 Original-Received: from localhost ([::1]:34420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksSZ8-00054C-Du for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 10:30:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksSZ1-00052f-6H for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 10:30:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksSZ0-0008Ig-UA for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 10:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ksSZ0-0000uc-Or for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 10:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Dec 2020 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23461 X-GNU-PR-Package: emacs Original-Received: via spool by 23461-submit@debbugs.gnu.org id=B23461.16088237883407 (code B ref 23461); Thu, 24 Dec 2020 15:30:02 +0000 Original-Received: (at 23461) by debbugs.gnu.org; 24 Dec 2020 15:29:48 +0000 Original-Received: from localhost ([127.0.0.1]:55909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksSYm-0000st-8Y for submit@debbugs.gnu.org; Thu, 24 Dec 2020 10:29:48 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:58683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksSYj-0000sZ-6B for 23461@debbugs.gnu.org; Thu, 24 Dec 2020 10:29:46 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id D1F392400FB for <23461@debbugs.gnu.org>; Thu, 24 Dec 2020 16:29:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1608823778; bh=0oezpeFyuYr1k1aXzXOM4SsXlhioCkVu+tJCLcyHaRc=; h=From:To:Cc:Subject:Date:From; b=jb/BKUTN1hHL6eyCweeygkVGAg5Chbm407nhromBdM/ZwN0ZRbLeJG7YsjaoAnQcq KWFN9DdUGhQXwRgJpU3jjqxuOVTb80/gIUa89OiSgYtz0QNf/AUuqiN7IxToZEOz6S hIgCRsctzWty5JIiSRxxN44EKPiBNKjYVBZcmiwickS6LEWcsw+ubPl3maB3w1xPL0 o6/sGW7VRHLOD/FqBTPIi5BKLGoUseyHCIVo0x+QCGCn8a+EFjBAy1AdVTS/bvgGwG XdrBfFx+n+ItCmGEsKoHoP1MBqvtd5H9IIit8BztPuXLcAtLprlA2oCqzDjzWkj7xk Kxdubbri7UoeA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4D1vBp189kz9rxL; Thu, 24 Dec 2020 16:29:38 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Wed, 23 Dec 2020 14:04:27 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196654 Archived-At: Stefan Monnier writes: > I suspect that shifting the "here-doc start" to the next line (in the > "#\n" case only) and placing a `syntax-multiline` property on all three > chars (#, \n, and the first char of the next line) will be our least > bad option. I have some doubts here regarding the effort and the side effects.... The current regexp for here-doc detection ends with the newline, so either it needs to capture that first char of the next line, or the property needs to be explicitly set. Also, the regexp in the following rule ("\\(?:$\\)\\s<" would no longer fire to call `perl-syntax-propertize-special-constructs`. Finally, that first character of the here-doc would fail to pass the "(eq 2 (nth 7 state))" test which has been introduced to fix the "current" bug#23461 in `perl-font-lock-syntactic-face-function`; the same test is used in some other places. That's a lot of special cases to handle, for an edge case like a "#" starting a comment in the last column. As for side effects, it would break word movement for the first word of within the here-doc, like it has been observed for the replacement string of a regexp in Bug#24101. While that's not a big deal, I found it pretty stunning. I understand now why this is happening, but I've no fix. Compared to that, just ignoring that special case is easy. It has no non-local side effects. The only downside is that in this special case a comment starter "#" is converted to a comment terminator "#" - so left unfontified. I could easily live with that. > [...] > I must admit I don't use Perl very much these days, but when I used it, > I used it as a "better shell", so I thought of Perl's here docs in > exactly the same way as sh's here docs. > > So maybe a compromise is to add a new `perl-heredoc` face and make it > inherit from `font-lock-string-face` by default? That's a possibility, sure. -- Cheers, haj