all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Anders Lindgren <andlind@gmail.com>
Cc: 23526-done@debbugs.gnu.org
Subject: bug#23526: 25.0.93; sh-mode heredoc triggers incorrectly
Date: Tue, 29 Aug 2017 09:44:33 -0400	[thread overview]
Message-ID: <jwvtw0qfq2e.fsf-monnier+bug#23526@gnu.org> (raw)
In-Reply-To: <CABr8ebb-=Am5vZm=Xx4BCdnktfAqvPRQgBAjbyHmM0MsUNQcoQ@mail.gmail.com> (Anders Lindgren's message of "Fri, 13 May 2016 09:51:59 +0200")

> 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	other threads:[~2017-08-29 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13  7:51 bug#23526: 25.0.93; sh-mode heredoc triggers incorrectly Anders Lindgren
2017-08-29 13:44 ` Stefan Monnier [this message]

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='jwvtw0qfq2e.fsf-monnier+bug#23526@gnu.org' \
    --to=monnier@iro.umontreal.ca \
    --cc=23526-done@debbugs.gnu.org \
    --cc=andlind@gmail.com \
    /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.