--- Begin Message ---
Subject: |
In Perl mode, TAB zaps EOF marker alignment |
Date: |
Mon, 14 Apr 2014 01:30:06 +0800 |
In Perl mode, TAB zaps EOF marker alignment.
$ cat p.pl
print <<\EOF;
<ol>
EOF
$ emacs p.pl
now do
C-x h runs the command mark-whole-buffer
TAB (translated from <tab>) runs the command indent-for-tab-command
The result is the EOF is no longer hugging the left margin!
Any following code will be printed out rather than executed, if indeed
the program's syntax is still valid.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#17262: In Perl mode, TAB zaps EOF marker alignment |
Date: |
Wed, 16 Apr 2014 10:13:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> In Perl mode, TAB zaps EOF marker alignment.
> $ cat p.pl
> print <<\EOF;
> <ol>
> EOF
> $ emacs p.pl
> now do
> C-x h runs the command mark-whole-buffer
> TAB (translated from <tab>) runs the command indent-for-tab-command
> The result is the EOF is no longer hugging the left margin!
Indeed, thanks.
I've installed the patch below which should fix it,
Stefan
=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el 2014-04-03 00:41:09 +0000
+++ lisp/progmodes/perl-mode.el 2014-04-16 14:11:39 +0000
@@ -903,7 +903,9 @@
;; following_quotep minimum_paren-depth_this_scan)
;; Parsing stops if depth in parentheses becomes equal to third arg.
(setq containing-sexp (nth 1 state)))
- (cond ((nth 3 state) 'noindent) ; In a quoted string?
+ (cond
+ ;; Don't auto-indent in a quoted string or a here-document.
+ ((or (nth 3 state) (eq 2 (nth 7 state))) 'noindent)
((null containing-sexp) ; Line is at top level.
(skip-chars-forward " \t\f")
(if (memq (following-char)
--- End Message ---