GNU bug report logs - #24101
24.5; incorrect double-click selection in cperl-mode

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Fri, 29 Jul 2016 00:07:01 UTC

Severity: minor

Tags: confirmed

Found in versions 24.5, 26.2

Full log


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

From: Harald Jörg <haj <at> posteo.de>
To: 24101 <at> debbugs.gnu.org
Subject: This bug is ... unfixable right now
Date: Tue, 04 Jul 2023 16:16:05 +0000
On 2016-07-28 20:05, Vincent Lefevre wrote:

> 1. Under X Window (so that Emacs uses its own interface), open
> a file containing:
> 
> # -*- mode: cperl -*-
> 
> tr/ABCDE/12345/;
> 
> 2. Double-click over "4".
> 
> Only "2345" is selected, instead of "12345".

The bug can still be reproduced in Emacs master (Emacs 30).
Unfortunately, it can not be fixed due to an Emacs limitation.

Background: cperl-mode treats the "match"-part and the
"replacement"-part differently.  To do that, cperl-mode uses the
"generic strings" of Emacs.  These need a delimiter character, but the
middle "/" can not serve as a end delimiter for the match part _and_ a
start delimiter of the replacement part.  So cperl-mode "cheats" and
makes the first character of the replacement part the start delimiter,
and by doing this, it is no longer part of the following "word".
Changing that would mean dropping significant features of cperl-mode.

Therefore, this only happens for words which start immediately after the
"/" which separates match- from replacement part.

A workaround is to use paired delimiters, because in that case
cperl-mode has two characters to use as end and start delimiter.
Selecting by double-clicking (or calling word-at-point) gives the
desired result.

    tr{ABCDE}{12345};

So, as of today I can still confirm the bug - but not fix it.
-- 
Cheers,
haj




This bug report was last modified 1 year and 345 days ago.

Previous Next


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