Package: emacs;
Reported by: Ed Avis <eda <at> waniasset.com>
Date: Tue, 4 Nov 2014 15:51:01 UTC
Severity: minor
Tags: confirmed
Found in versions 26.1, 26.3, 24.4
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Ed Avis <eda <at> waniasset.com> To: "'bug-gnu-emacs <at> gnu.org'" <bug-gnu-emacs <at> gnu.org> Subject: 24.4; perl-mode electric-indent inside here documents Date: Tue, 4 Nov 2014 15:50:00 +0000
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 ______________________________________________________________________
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.