bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23526: 25.0.93; sh-mode heredoc triggers incorrectly


From: Stefan Monnier
Subject: bug#23526: 25.0.93; sh-mode heredoc triggers incorrectly
Date: Tue, 29 Aug 2017 09:44:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> In some cases, the "heredoc" system of sh-mode triggers on things that
> aren't heredocs.
> Steps to repeat:
>     Create a file, test.sh, with the following content:
> ========8<--------
> # This is a normal comment
> echo "<<HELLO>>"
> # This is incorrectly highlighted as a heredoc comment.
> echo "This is also incorrectly highlighted as a heredoc comment"
> ========8<--------
>     emacs -Q test.sh
> Now, the two last lines are highlighted as a heredoc.

Indeed, thanks for catching it.
I installed the patch below which seems to fix it.


        Stefan


diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 54c47b719f..ea2e98424f 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1138,7 +1138,7 @@ sh-syntax-propertize-function
    (syntax-propertize-rules
     (sh-here-doc-open-re
      (2 (sh-font-lock-open-heredoc
-         (match-beginning 0) (match-string 1) (match-beginning 2))))
+         (1+ (match-beginning 0)) (match-string 1) (match-beginning 2))))
     ("\\s|" (0 (prog1 nil (sh-syntax-propertize-here-doc end))))
     ;; A `#' begins a comment when it is unquoted and at the
     ;; beginning of a word.  In the shell, words are separated by





reply via email to

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