Subject: Re: bug#9333: 23.3; shell script mode: "<<" starts here doc even on comment line
From: Stefan Monnier <[email-masked]>
To: Ryo Furue <[email-masked]>
Cc: [email-masked]
Date: Mon, 22 Aug 2011 18:11:30 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> In the shell-script mode, typing "<<" on a comment line starts
> a here document.  I use "<< . . ." in comments as a personal
> style in many computer languages including shell.

I've installed the patch below which should fix this issue.

        Stefan

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2011-08-22 21:16:46 +0000
+++ lisp/ChangeLog	2011-08-22 22:09:55 +0000
@@ -1,5 +1,8 @@
 2011-08-22  Stefan Monnier  <[email-masked]>
 
+	* progmodes/sh-script.el (sh-maybe-here-document): Disable magic in
+	strings and comments (bug#9333).
+
 	* emacs-lisp/debug.el (debug-arglist): New function.
 	(debug-convert-byte-code): Use it.  Handle lexical byte-codes.
 	(debug-on-entry-1): Handle interpreted closures (bug#9120).

=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el	2011-08-04 00:58:07 +0000
+++ lisp/progmodes/sh-script.el	2011-08-22 22:08:26 +0000
@@ -460,6 +460,7 @@
     (define-key map "\C-c+" 'sh-add)
     (define-key map "\C-\M-x" 'sh-execute-region)
     (define-key map "\C-c\C-x" 'executable-interpret)
+    ;; FIXME: Use post-self-insert-hook.
     (define-key map "<" 'sh-maybe-here-document)
     (define-key map "(" 'skeleton-pair-insert-maybe)
     (define-key map "{" 'skeleton-pair-insert-maybe)
@@ -3659,6 +3660,7 @@
       (save-excursion
 	(backward-char 2)
 	(sh-quoted-p))
+      (nth 8 (syntax-ppss))
       (let ((tabs (if (string-match "\\`-" sh-here-document-word)
                       (make-string (/ (current-indentation) tab-width) ?\t)
                     ""))