Subject: bug#72296: closed (Re: bug#72296: 29.4; cperl-mode parsing error)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 27 Jul 2024 08:05:02 +0000

Your bug report

#72296: 29.4; cperl-mode parsing error

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

-- 
72296: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72296
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72296: 29.4; cperl-mode parsing error
From: Eli Zaretskii <[email-masked]>
To: Harald Jörg <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 27 Jul 2024 11:04:15 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: brian <[email-masked]>
> From: Harald Jörg <[email-masked]>
> Date: Thu, 25 Jul 2024 19:06:35 +0000
> 
> brian <[email-masked]> writes:
> 
> > I started emacs using 'emacs -Q /tmp/some-empty-file.pl' and activated
> > cperl mode by 'M-x cperl-mode'. I typed 'for (2..$n/2) {}' into the
> > empty buffer and as soon as I pressed '/' there was an error message in
> > the minibuffer
> >
> > End of ‘/ ... /’ string/RE not found: (scan-error Unbalanced
> > parentheses 11 38)
> >
> > and syntax hilighting was broken. Inserting a single space before '$'
> > cleared the error and fixed the hilighting.
> 
> I can reproduce this and am about to prepare a fix.
> 
> That code sits here since 1997, I find it rather surprising that it has
> not surfaced until now.  I'll run some tests and add a test case.  If I
> am not mistaken, then replacing a `progn` with `save-excursion` should
> do the trick:
> 
> index b85db699e72..34481925d3e 100644
> --- a/lisp/progmodes/cperl-mode.el
> +++ b/lisp/progmodes/cperl-mode.el
> @@ -4108,7 +4108,7 @@ cperl-find-pods-heres
>                                     (and (eq (preceding-char) ?\})
>                                          (cperl-after-block-p (point-min)))
>                                     (and (eq (char-syntax (preceding-char)) ?w)
> -                                        (progn
> +                                        (save-excursion
>                                            (forward-sexp -1)
>  ;; After these keywords `/' starts a RE.  One should add all the
>  ;; functions/builtins which expect an argument, but ...
> 
> In newer versions the line numbers are different (~4650) but the issue
> is the same.  The unprotected (forward-sexp -1) skips over $n and the
> two characters before that are '..' which, in the following clause,
> makes the construct look like a flip-flop operator where '/' does start
> a regular expression.  Using 'save-excursion' undoes the skip before
> running the next checks.

Thanks, since this appears to be fixed on the emacs-30 branch, I'm
closing this bug.

Subject: 29.4; cperl-mode parsing error
From: brian <[email-masked]>
To: [email-masked]
Date: Thu, 25 Jul 2024 14:29:37 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I started emacs using 'emacs -Q /tmp/some-empty-file.pl' and activated
cperl mode by 'M-x cperl-mode'. I typed 'for (2..$n/2) {}' into the
empty buffer and as soon as I pressed '/' there was an error message in
the minibuffer

End of ‘/ ... /’ string/RE not found: (scan-error Unbalanced parentheses 
11 38)

and syntax hilighting was broken. Inserting a single space before '$'
cleared the error and fixed the hilighting.

In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.18.0) of 2024-06-24 built on dev
Windowing system distributor 'The X.Org Foundation', version 11.0.12302000
System Description: Ubuntu 23.10

Configured using:
'configure --prefix=/opt/emacs --with-cairo --with-libsystemd
--with-mailutils --with-native-compilation --with-pop=yes
--with-sound=alsa --with-toolkit-scroll-bars --with-x-toolkit=gtk3
--with-x=yes --without-gconf 'CFLAGS=-g -O2''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
value of $LANG: en_GB.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix

Major mode: CPerl

Minor modes in effect:
rainbow-delimiters-mode: t
global-hl-line-mode: t
savehist-mode: t
which-key-mode: t
marginalia-mode: t
vertico-mode: t
yas-global-mode: t
yas-minor-mode: t
global-flycheck-mode: t
flycheck-mode: t
global-display-fill-column-indicator-mode: t
display-fill-column-indicator-mode: t
global-display-line-numbers-mode: t
display-line-numbers-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t

Load-path shadows:
/home/brian/.emacs.d/elpa/transient-20240603.2200/transient hides 
/opt/emacs/share/emacs/29.4/lisp/transient

Features:
(shadow sort mail-extr emacsbug message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util text-property-search mailabbrev gmm-utils mailheader sendmail
mail-utils mule-util orderless comp comp-cstr warnings cperl-mode
facemenu rainbow-delimiters hl-line savehist which-key move-text
org-tempo org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete pcomplete comint ansi-osc ring org-list
org-footnote org-faces org-entities time-date noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs
org-compat tempo org-version org-macs format-spec marginalia vertico
compat yasnippet-snippets yasnippet diminish flycheck ansi-color
find-func rx display-fill-column-indicator display-line-numbers
ef-dark-theme ef-themes cus-edit pp cus-load icons wid-edit edmacro
kmacro quelpa-use-package cl-extra quelpa mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
lisp-mnt help-fns radix-tree help-mode use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf all-the-icons-dired-autoloads
all-the-icons-autoloads auctex-autoloads tex-site avy-autoloads
cdlatex-autoloads corfu-autoloads diminish-autoloads ef-themes-autoloads
embark-consult-autoloads consult-autoloads embark-autoloads
flycheck-autoloads helpful-autoloads elisp-refs-autoloads jinx-autoloads
json-mode-autoloads keycast-autoloads logos-autoloads
magit-todos-autoloads magit-autoloads pcase git-commit-autoloads
hl-todo-autoloads f-autoloads async-autoloads marginalia-autoloads
markdown-mode-autoloads move-text-autoloads orderless-autoloads
org-modern-autoloads osm-autoloads pcre2el-autoloads pdf-tools-autoloads
perltidy-autoloads quelpa-use-package-autoloads quelpa-autoloads
rainbow-delimiters-autoloads realgud-autoloads
realgud-recursive-autoloads loc-changes-autoloads
load-relative-autoloads s-autoloads spacious-padding-autoloads
svg-lib-autoloads tablist-autoloads taxy-magit-section-autoloads
taxy-autoloads magit-section-autoloads dash-autoloads
test-simple-autoloads transient-autoloads treepy-autoloads
vertico-autoloads which-key-autoloads with-editor-autoloads info
compat-autoloads ws-butler-autoloads yaml-autoloads yaml-mode-autoloads
yasnippet-snippets-autoloads yasnippet-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib 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 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 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 507989 330210)
(symbols 48 28255 420)
(strings 32 141117 47270)
(string-bytes 1 4103290)
(vectors 16 44098)
(vector-slots 8 844183 452452)
(floats 8 157 942)
(intervals 56 373 368)
(buffers 984 12))