From: Lars Ingebrigtsen <larsi@gnus.org>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 38658@debbugs.gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: bug#38658: perl-mode: EOF in same color as here doc text
Date: Thu, 06 Aug 2020 12:31:55 +0200 [thread overview]
Message-ID: <87lfisdq04.fsf@gnus.org> (raw)
In-Reply-To: <871rt1oiri.5.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Wed, 18 Dec 2019 21:39:13 +0800")
積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
> $ nl e.pl
> 1 print <<EOF;
> 2 bla
> 3 EOF
> $ emacs e.pl
>
> Why is line 1 in color A, and lines 2 and 3 in color B?
> How about instead lines 1 and 3 in color A, and line 2 in color B?
This is apparently due to the following code:
(defun perl-syntax-propertize-special-constructs (limit)
[...]
;; A Here document.
(let ((names (cdr (get-text-property (nth 8 state) 'syntax-table))))
(when (cdr names)
(setq names (reverse names))
;; Multiple heredocs on a single line, we have to search from the
;; beginning, since we don't know which names might be
;; before point.
(goto-char (nth 8 state)))
(while (and names
(re-search-forward
(pcase-let ((`(,name . ,indented) (pop names)))
(concat "^" (if indented "[ \t]*")
(regexp-quote name) "\n"))
limit 'move))
(unless names
(put-text-property (1- (point)) (point) 'syntax-table
(string-to-syntax "> c"))))))
We apparently want to put that syntax on at the end of the heredoc, but
stop fontifying at the start of the final EOF. I poked around a bit in
the code to see whether I could make it do that, and... I can't.
So I'm Cc-ing Stefan, who wrote this. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-08-06 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 13:39 bug#38658: perl-mode: EOF in same color as here doc text 積丹尼 Dan Jacobson
2020-08-06 10:31 ` Lars Ingebrigtsen [this message]
2020-08-06 14:39 ` Stefan Monnier
2020-08-07 6:49 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfisdq04.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=38658@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.