Subject: bug#79269: closed (Indentation and fontification of signatures fixed)

From: John C <[email-masked]>
Date: Wed, 27 Aug 2025 20:12:48 -0400

Hi

Thanks for trying to fix this, but it seems there's still an issue. In the
attached test.pl, the indent is off. Can you take a look?

On Fri, Aug 22, 2025 at 8:12 AM GNU bug Tracking System <
[email-masked]> wrote:

> Your bug report
>
> #79269: 30.1; cperl-mode does not handle signatures correctly
>
> which was filed against the emacs package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to [email-masked].
>
> --
> 79269: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79269
> GNU Bug Tracking System
> Contact [email-masked] with problems
>
>
>
> ---------- Forwarded message ----------
> From: "Harald Jörg" <[email-masked]>
> To: [email-masked]
> Cc:
> Bcc:
> Date: Fri, 22 Aug 2025 12:11:44 +0000
> Subject: Indentation and fontification of signatures fixed
> Both parts of the bug report (thanks for the excellent recipe) have now
> been fixed in the "master" branch, tests have been added using the
> example code from the report.
> --
> Cheers,
> haj
>
>
>
>
> ---------- Forwarded message ----------
> From: John Ciolfi <[email-masked]>
> To: <[email-masked]>
> Cc:
> Bcc:
> Date: Tue, 19 Aug 2025 12:05:37 -0400
> Subject: 30.1; cperl-mode does not handle signatures correctly
>
> 1. In a temporary directory, say ~/tmp/, get latest cperl-mode.el from
>
> https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/cperl-mode.el
>    I used the Jul-28-2025 version
>
> https://github.com/emacs-mirror/emacs/blob/cef4302d309e26c2191821ba998518fb89fff54e/lisp/progmodes/cperl-mode.el
>
> 2. cd ~/tmp
>
> 3. emacs -Q -L .           # Using emacs 30.1
>
> 4. M-x byte-compile-file RET cperl-mode.el RET
>
> 5. C-x C-f foo.pl
>
>    C-x h   # select all of foo.pl
>    C-M-\   # indent foo.pl
>
> Here's the indented foo.pl. Notice that there are a couple problems
> which appears to be due to the incorrect handling of perl signatures.
> Note, perl-mode.el seems to handle signatures correctly, so maybe that
> code can be borrowed for cperl-mode.el?
>
>
> # -*- mode: cperl -*-
> use strict;
> use warnings;
> use experimental 'signatures';
>
> foo(1);
>
> sub foo (
>          $in1,
>          $optionsHPtr = {},
>          $otherOption1 = 1,     # Bug: wrong face for this option
>         ) {
>
>    my $a = 1;  # Bug: should be indented by 2 spaces
>
>  # Bug: following are not indented due to use of signatures
>  my $b = 2;
>  return $a + $b + $in1;
> }
>
>
>
> In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
>  cairo version 1.16.0) of 2025-04-04, modified by Debian built on sbuild
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101006
> System Description: Debian GNU/Linux 12 (bookworm)
>
> Configured using:
>  'configure --build x86_64-linux-gnu --prefix=/usr
>  --sharedstatedir=/var/lib --libexecdir=/usr/libexec
>  --localstatedir=/var/lib --infodir=/usr/share/info
>  --mandir=/usr/share/man --with-libsystemd --with-pop=yes
>
>  --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
>  --with-sound=alsa --without-gconf --with-mailutils --build
>  x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
>  --libexecdir=/usr/libexec --localstatedir=/var/lib
>  --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
>  --with-pop=yes
>
>  --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
>  --with-sound=alsa --without-gconf --with-mailutils --with-cairo
>  --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
>  'CFLAGS=-g -O2
>  -ffile-prefix-map=/build/reproducible-path/emacs-30.1+1=.
> -fstack-protector-strong
>  -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
>  -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
> NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
>
> Important settings:
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: CPerl
>
> Minor modes in effect:
>   tooltip-mode: t
>   global-eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   minibuffer-regexp-mode: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>
> Load-path shadows:
> /home/ciolfi/tmp/cperl-mode hides
> /usr/share/emacs/30.1/lisp/progmodes/cperl-mode
>
> Features:
> (shadow sort mail-extr emacsbug message mailcap yank-media puny dired
> dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
> epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse
> rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail
> rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils compile
> text-property-search comint subr-x ansi-osc ansi-color ring comp-run
> bytecomp byte-compile comp-common cperl-mode rx facemenu rmc iso-transl
> tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
> lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
> touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list
> replace newcomment text-mode lisp-mode prog-mode register page tab-bar
> menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
> jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
> nadvice seq simple cl-generic indonesian philippine cham georgian
> utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
> japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
> ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
> case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
> cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
> files window text-properties overlay sha1 md5 base64 format env
> code-pages mule custom widget keymap hashtable-print-readable backquote
> threads dbusbind inotify lcms2 dynamic-setting system-font-setting
> font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
> make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 84401 12096) (symbols 48 7366 0) (strings 32 20464 1856)
>  (string-bytes 1 700197) (vectors 16 11848)
>  (vector-slots 8 163636 10525) (floats 8 26 34) (intervals 56 418 0)
>  (buffers 992 12))
>
>
>