unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18944: 24.4; perl-mode electric-indent inside here documents
@ 2014-11-04 15:50 Ed Avis
  2019-09-20 23:12 ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Ed Avis @ 2014-11-04 15:50 UTC (permalink / raw)
  To: 18944

In Perl (as in the Unix shell), a "here document" is a string that
begins with a marker such as <<END and continues until a line containing
just END.  The text between these markers is part of the string, not
tokenized Perl code; in particular, it doesn't need to be indented
as if it were part of the program itself.

However, at the moment perl-mode doesn't fully recognize these strings
and attempts to indent their content somehow.  I think this is a long-
standing problem but it has recently become more visible now that
electric-indent-mode is enabled by default.

Start a new buffer and M-x perl-mode.  Enter this text:

my $x = <<END

and hit Return.  The cursor is positioned on the next line indented by
four spaces (depending on your default indent level).  This is not
really correct; most of the time you don't want your quoted string to
start with four literal space characters, so it would be more helpful
for Emacs not to indent.

But even if you delete the four spaces and enter a line of text

foo

followed by Return, it will jump and indent itself.  This is
frustrating.

Now, perl-mode does understand strings quoted with "" and '', and knows
that the contents of them should not be automatically indented, even
when the string contains embedded newlines.  It needs to extend that
understanding to here documents beginning <<WHATEVER.

If this is not practical, perhaps the indentation could be kept (so
if you hit Tab inside the here document it will still do something
weird) but the electric-indent behaviour will be temporarily disabled
while the user is entering the content of a here document.



In GNU Emacs 24.4.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9)
 of 2014-11-03 on wcl-linux04.wcl.local
Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
 -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Perl

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
l l RET ESC > ESC p RET . / f e TAB g r TAB RET ESC 
p - - m a i l RET C-p C-p C-p C-p C-p C-p C-p C-p C-n 
C-c v RET C-x 1 ESC > C-x 2 C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n 
C-n C-n C-n C-x o C-x b RET C-x p C-x o C-x C-g C-p 
C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n RET C-_ 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p RET 
RET C-p TAB i f SPC ( $ o p t _ r e p l a c e ) SPC 
{ RET TAB $ s q l SPC = SPC < < E N D RET C-a C-k C-k 
C-k RET C-p C-p C-p C-p C-n C-n C-n u p d a t e SPC 
a l r e a d y RET s e t SPC C-a C-p C-d C-d C-d C-d 
C-d C-d C-d C-d C-d C-d C-d C-d C-n C-d C-d C-d C-d 
C-d C-d C-d C-d C-d C-d C-d C-d C-e C-k C-k RET E N 
D RET ; C-p C-p C-e RET C-a C-p C-p TAB C-n TAB C-a 
C-p C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d 
C-d e DEL C-e RET C-_ C-_ C-a C-k ESC x r e p l a c 
e DEL DEL DEL DEL o r - SPC DEL SPC RET

Recent messages:
Auto-saving...done
Auto-saving...done
Saving file /home/eda/svn_working/repos/sql/WCL-SQL-LIVE/tradingsystemsprod/vwTradingSystemsRunRiskCapitalByFund.sql...
Wrote /home/eda/svn_working/repos/sql/WCL-SQL-LIVE/tradingsystemsprod/vwTradingSystemsRunRiskCapitalByFund.sql
Saving file /home/eda/svn_working/repos/sql/WCL-SQL-LIVE/tradingsystemsprod/vwTradingSystemsRunRiskCapitalByFund.sql...
Wrote /home/eda/svn_working/repos/sql/WCL-SQL-LIVE/tradingsystemsprod/vwTradingSystemsRunRiskCapitalByFund.sql
Mark set [2 times]
C-x p is undefined
C-x C-g is undefined
Undo! [3 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail sql view ffap thingatpt
url-parse auth-source eieio eieio-core gnus-util password-cache url-vars
nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
misearch multi-isearch help-mode dabbrev diff-mode vc vc-dispatcher
vc-svn cus-edit wid-edit cus-start cus-load perl-mode pcmpl-unix dired
xterm time-date log-edit easy-mmode message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log server csharp-mode advice help-fns byte-opt bytecomp
byte-compile cconv cc-langs cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs zoom-frm frame-cmds
frame-fns cl-macs avoid cl gv cl-loaddefs cl-lib compile shell pcomplete
comint ring ansi-color tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 357122 49889)
 (symbols 48 28025 0)
 (miscs 40 271 1603)
 (strings 32 50592 4464)
 (string-bytes 1 2568677)
 (vectors 16 26047)
 (vector-slots 8 1283877 223538)
 (floats 8 269 645)
 (intervals 56 27624 0)
 (buffers 960 44)
 (heap 1024 32251 1650))


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________





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

end of thread, other threads:[~2022-01-25 14:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 15:50 bug#18944: 24.4; perl-mode electric-indent inside here documents Ed Avis
2019-09-20 23:12 ` Stefan Kangas
2019-09-23  8:35   ` Ed Avis
2019-09-23  9:15     ` Stefan Kangas
2019-09-23  9:23       ` Ed Avis
2022-01-25 14:08     ` Lars Ingebrigtsen
     [not found]       ` <PH0PR11MB56117AD63C236DE5DC7E4743845F9@PH0PR11MB5611.namprd11.prod.outlook.com>
2022-01-25 14:23         ` Lars Ingebrigtsen

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