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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: avarab@HIDDEN (Ævar Arnfjörð Bjarmason); Keywords: confirmed; dated Fri, 7 Nov 2014 16:44:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as found in versions 26.2. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) confirmed. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 18985 <at> debbugs.gnu.org:


Received: (at 18985) by debbugs.gnu.org; 5 Jul 2019 20:04:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 05 16:04:23 2019
Received: from localhost ([127.0.0.1]:53814 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hjURT-0007h3-By
	for submit <at> debbugs.gnu.org; Fri, 05 Jul 2019 16:04:23 -0400
Received: from mail-wr1-f49.google.com ([209.85.221.49]:40481)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1hjURQ-0007gl-TJ
 for 18985 <at> debbugs.gnu.org; Fri, 05 Jul 2019 16:04:21 -0400
Received: by mail-wr1-f49.google.com with SMTP id r1so4662851wrl.7
 for <18985 <at> debbugs.gnu.org>; Fri, 05 Jul 2019 13:04:20 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc
 :content-transfer-encoding;
 bh=0iWhIbDtM7juwn16nZtjQk4v25/dXocjpzMPrcLWlAo=;
 b=pv0DcJSHh+sS02psJ39e5pV3bPqFG4E485/oY1GvLWcNljMC3s2GNWI551HeytWsj/
 RQLx74TA4EVj5Dx2m2elDKEOZuc/AF4oTyeT0AIp7Bwp8E8IIMEDuFVpWh9sHlnT388v
 bcQd91pVnN9OyBiMDPAoxW18CiEQ8QjjnD9+4J4lJix2dba6ptY4Z0Rk//Z2x+iEg0fo
 THwf3bO0tFOneGaa0QHH00dlRLDh9fdS3OgRCrwpU7D2rf2pUyJP0nXeu9lcqGR+LWsz
 HnFjmJF41vzZxjFlBQF6v20jLtZpjzJvCh5BOfw4Ri+WAFbsCenYHUO2vkFqdb//99cy
 p94g==
X-Gm-Message-State: APjAAAUE59tBSrgFMP6HgGcoHikS/JNVAiq9eGVHugxKceQ/wKBUolvL
 ZGhMSQQI2g6/lflOAT5rJEUFS0y/tf7bm7FN12o=
X-Google-Smtp-Source: APXvYqwvdCCziCVhYb1oSe6grpISYQwI9w7PMSkcd0Gt9mnN8f/HykFAR1sEbXxENou8JSgp+MAlk1bvRuXijlBHGLg=
X-Received: by 2002:a05:6000:14b:: with SMTP id
 r11mr5288313wrx.196.1562357054142; 
 Fri, 05 Jul 2019 13:04:14 -0700 (PDT)
MIME-Version: 1.0
From: Stefan Kangas <stefan@HIDDEN>
Date: Fri, 5 Jul 2019 22:04:03 +0200
Message-ID: <CADwFkmkJa21n4wH357P_HcAL_w1EXOY49RaXjpMnJHzZk1N19Q@HIDDEN>
Subject: Re: bug#18985: 24.3; cperl-mode misindents hash keys that start with
 an auto-quoted keyword
To: avarab@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 18985
Cc: 18985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

avarab@HIDDEN (=C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason) writes:

> cperl-mode has a nasty bug in M-x indent-region, if you write this to a
> file:
>
>     my %x =3D (
>         for_me =3D> "cookie",
>     );
>
> And indent it you end up with:
>
>     my %x =3D (
>      for _me =3D> "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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18985; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Nov 2014 16:43:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 07 11:43:24 2014
Received: from localhost ([127.0.0.1]:53073 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XmmdA-0001Qs-1x
	for submit <at> debbugs.gnu.org; Fri, 07 Nov 2014 11:43:24 -0500
Received: from eggs.gnu.org ([208.118.235.92]:47000)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <avarab@HIDDEN>) id 1Xmgif-0007HF-Vk
 for submit <at> debbugs.gnu.org; Fri, 07 Nov 2014 05:24:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <avarab@HIDDEN>) id 1XmgiW-0005ms-Pe
 for submit <at> debbugs.gnu.org; Fri, 07 Nov 2014 05:24:41 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:34002)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <avarab@HIDDEN>) id 1XmgiW-0005ml-Mh
 for submit <at> debbugs.gnu.org; Fri, 07 Nov 2014 05:24:32 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48675)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <avarab@HIDDEN>) id 1XmgiQ-00083j-Bl
 for bug-gnu-emacs@HIDDEN; Fri, 07 Nov 2014 05:24:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <avarab@HIDDEN>) id 1XmgiJ-0005ji-B8
 for bug-gnu-emacs@HIDDEN; Fri, 07 Nov 2014 05:24:26 -0500
Received: from u.nix.is ([5.9.157.150]:47628)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <avarab@HIDDEN>) id 1XmgiJ-0005im-4v
 for bug-gnu-emacs@HIDDEN; Fri, 07 Nov 2014 05:24:19 -0500
Received: from u.nix.is (localhost [127.0.0.1])
 by u.nix.is (Postfix) with ESMTP id 5998016A655E
 for <bug-gnu-emacs@HIDDEN>; Fri,  7 Nov 2014 10:24:17 +0000 (UTC)
From: avarab@HIDDEN (=?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason)
To: bug-gnu-emacs@HIDDEN
Subject: 24.3; cperl-mode misindents hash keys that start with an auto-quoted
 keyword
Date: Fri, 07 Nov 2014 10:24:13 +0000
Message-ID: <878ujns3zm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 07 Nov 2014 11:43:22 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)


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)




Acknowledgement sent to avarab@HIDDEN (Ævar Arnfjörð Bjarmason):
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#18985; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 23 Aug 2019 06:45:01 UTC

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