unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17262: In Perl mode, TAB zaps EOF marker alignment
@ 2014-04-13 17:30 積丹尼 Dan Jacobson
  2014-04-16 14:13 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-04-13 17:30 UTC (permalink / raw)
  To: 17262

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.






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#17262: In Perl mode, TAB zaps EOF marker alignment
  2014-04-13 17:30 bug#17262: In Perl mode, TAB zaps EOF marker alignment 積丹尼 Dan Jacobson
@ 2014-04-16 14:13 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-04-16 14:13 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 17262-done

> 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)






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-16 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-13 17:30 bug#17262: In Perl mode, TAB zaps EOF marker alignment 積丹尼 Dan Jacobson
2014-04-16 14:13 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).