GNU bug report logs - #18985
24.3; cperl-mode misindents hash keys that start with an auto-quoted keyword

Previous Next

Package: emacs;

Reported by: avarab <at> gmail.com (Ævar Arnfjörð Bjarmason)

Date: Fri, 7 Nov 2014 16:44:01 UTC

Severity: normal

Tags: confirmed, fixed

Found in versions 24.3, 26.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18985 in the body.
You can then email your comments to 18985 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18985; Package emacs. (Fri, 07 Nov 2014 16:44:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to avarab <at> gmail.com (Ævar Arnfjörð Bjarmason):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 07 Nov 2014 16:44:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: avarab <at> gmail.com (Ævar Arnfjörð Bjarmason)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; cperl-mode misindents hash keys that start with an auto-quoted
 keyword
Date: Fri, 07 Nov 2014 10:24:13 +0000
cperl-mode has a nasty bug in M-x indent-region, if you write this to a
file:
    
    my %x = (
        for_me => "cookie",
    );

And indent it you end up with:

    my %x = (
	 for _me => "cookie",
    );

Note the space between the "for" and "_me", the indenter falsely thought
that "for" was a keyword and suffixed it with a space, changing the
semantics of the code.

The same issue happens with some other keywords, e.g. "if" and "until",
but interestingly not "unless".
    
    
In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu)
 of 2014-09-08 on binet, modified by Debian
System Description:	Debian GNU/Linux testing (jessie)

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=no'
 '--without-gconf' '--without-gsettings' 'build_alias=x86_64-linux-gnu'
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' 'LDFLAGS=-Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: CPerl

Minor modes in effect:
  menu-bar-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:
C-@ C-x h C-w i f SPC ( DEL DEL DEL DEL f o r _ m e 
SPC = > SPC " c o o k i e " ; DEL , C-a C-@ C-e ESC 
x i n d e n t - r e g TAB RET ESC x c p e r l - m o 
d e RET C-a C-p RET C-p m y SPC % x SPC = SPC ( C-n 
TAB C-e RET ) TAB ; C-@ C-p C-p C-a ESC x i n d e n 
t - r e g TAB RET C-_ C-@ C-n C-g C-@ C-p C-p C-a ESC 
w C-x b C-g ESC x r e p o r t - e m a TAB RET

Recent messages:
Mark set [3 times]
Mark activated
You can run the command `indent-region' with C-M-\
byte-code: Beginning of buffer
End of `mf ... f' string/RE not found: (scan-error Unbalanced parentheses 3 22)
Mark set
Undo!
Mark set
Quit
Mark set
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cperl-mode easymenu time-date ediff-hook
vc-hooks lisp-float-type tabulated-list newcomment lisp-mode register
page menu-bar rfn-eshadow timer select 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 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 multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18985; Package emacs. (Fri, 05 Jul 2019 20:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 18985 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: avarab <at> gmail.com
Cc: 18985 <at> debbugs.gnu.org
Subject: Re: bug#18985: 24.3; cperl-mode misindents hash keys that start with
 an auto-quoted keyword
Date: Fri, 5 Jul 2019 22:04:03 +0200
avarab <at> gmail.com (Ævar Arnfjörð Bjarmason) writes:

> cperl-mode has a nasty bug in M-x indent-region, if you write this to a
> file:
>
>     my %x = (
>         for_me => "cookie",
>     );
>
> And indent it you end up with:
>
>     my %x = (
>      for _me => "cookie",
>     );
>
> Note the space between the "for" and "_me", the indenter falsely thought
> that "for" was a keyword and suffixed it with a space, changing the
> semantics of the code.
>
> The same issue happens with some other keywords, e.g. "if" and "until",
> but interestingly not "unless".

I can reproduce this on Emacs 26.2.

Best regards,
Stefan Kangas




Added tag(s) confirmed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 23 Aug 2019 06:40:03 GMT) Full text and rfc822 format available.

bug Marked as found in versions 26.2. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 23 Aug 2019 06:40:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18985; Package emacs. (Thu, 27 Aug 2020 21:14:02 GMT) Full text and rfc822 format available.

Message #15 received at 18985 <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: 18985 <at> debbugs.gnu.org
Subject: [PATCH] Fix indent-region for identifiers with underscores
Date: Thu, 27 Aug 2020 23:13:08 +0200
[Message part 1 (text/plain, inline)]
Another bug report from 2014 caught my attention.
A patch is attached.
-- 
Cheers,
haj
[0001-2020-08-27-Harald-J-rg-haj-posteo.de.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18985; Package emacs. (Fri, 28 Aug 2020 14:33:02 GMT) Full text and rfc822 format available.

Message #18 received at 18985 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Harald Jörg <haj <at> posteo.de>
Cc: 18985 <at> debbugs.gnu.org
Subject: Re: bug#18985: [PATCH] Fix indent-region for identifiers with
 underscores
Date: Fri, 28 Aug 2020 16:31:51 +0200
Harald Jörg <haj <at> posteo.de> writes:

> Another bug report from 2014 caught my attention.
> A patch is attached.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 28 Aug 2020 14:33:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 18985 <at> debbugs.gnu.org and avarab <at> gmail.com (Ævar Arnfjörð Bjarmason) Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 28 Aug 2020 14:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 26 Sep 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 266 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.