[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38658: perl-mode: EOF in same color as here doc text

From: Lars Ingebrigtsen
Subject: bug#38658: perl-mode: EOF in same color as here doc text
Date: Thu, 06 Aug 2020 12:31:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

積丹尼 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
                     (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]