* bug#46024: Perl mode colors the word "argument" funny
@ 2021-01-21 20:05 積丹尼 Dan Jacobson
2021-01-22 0:33 ` Harald Jörg
0 siblings, 1 reply; 5+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-01-21 20:05 UTC (permalink / raw)
To: 46024
Perl mode colors the word "argument" funny:
for ( $r[$v] ) {
$_->{argument} = 0 + shift;
}
Cperl mode doesn't.
emacs-version "27.1"
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46024: Perl mode colors the word "argument" funny
2021-01-21 20:05 bug#46024: Perl mode colors the word "argument" funny 積丹尼 Dan Jacobson
@ 2021-01-22 0:33 ` Harald Jörg
2021-01-22 18:38 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Harald Jörg @ 2021-01-22 0:33 UTC (permalink / raw)
To: 46024; +Cc: 積丹尼 Dan Jacobson
積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
> Perl mode colors the word "argument" funny:
> for ( $r[$v] ) {
> $_->{argument} = 0 + shift;
> }
> Cperl mode doesn't.
> emacs-version "27.1"
"argument" as a keyword in Perl mode came as a patch for Bug#27613 -
together with a couple of other keywords: anon, has, our, state,
supersede, let, and temp.
However, only 'our' and 'state' are part of Perl 5. A keyword 'has' is
available with popular Perl extensions (Moose, Moo etc.), so arguably
fontification as a declarator is acceptable... though slightly
inaccurate.
The keywords 'anon', 'has', 'supersede', 'let' and 'temp' are part of
the Raku language, which started as "Perl 6", as described in the
language docs:
https://docs.raku.org/language/variables#Variable_declarators_and_scope.
'argument' apparently didn't make it into the language at all, but Raku
also has 'augment' and 'constant', and Perl's 'local' is called 'temp'
in Raku.
CPerl mode has caught only a few keywords from non-core Perl, these are
also available with popular extensions ('try','catch','finally'). Perl
mode seems to have adopted some more Raku-stuff (e.g. it registers
variable names like "my $amazing-variable" to imenu, but fontifies only
the $amazing-part).
So I wonder: What is the ambition of Emacs to support Raku? The
languages Perl (Perl 5) and Raku (Perl 6) have diverged in their syntax,
so robably it is rather cumbersome to support both with any of the Perl
modes. In my opionion, randomly adding Raku features to the modes
brings more confusion than productivity, and in any case keywords which
are no longer part of either language should be eliminated, in
particular: 'argument', which is the topic of this bug report.
--
Cheers,
haj
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46024: Perl mode colors the word "argument" funny
2021-01-22 0:33 ` Harald Jörg
@ 2021-01-22 18:38 ` Lars Ingebrigtsen
2021-01-27 14:08 ` bug#46024: Perl mode colors the word "argument" funny [PATCH] Harald Jörg
0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-22 18:38 UTC (permalink / raw)
To: Harald Jörg; +Cc: 46024, 積丹尼 Dan Jacobson
haj@posteo.de (Harald Jörg) writes:
> So I wonder: What is the ambition of Emacs to support Raku? The
> languages Perl (Perl 5) and Raku (Perl 6) have diverged in their syntax,
> so robably it is rather cumbersome to support both with any of the Perl
> modes. In my opionion, randomly adding Raku features to the modes
> brings more confusion than productivity, and in any case keywords which
> are no longer part of either language should be eliminated, in
> particular: 'argument', which is the topic of this bug report.
Long term, it does seem like the best solution would be to have a
separate mode for Raku, and not keep tweaking (c)perl-mode to add Raku
features, I think.
So backing out this change ('argument' etc) sounds like a good idea to
me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46024: Perl mode colors the word "argument" funny [PATCH]
2021-01-22 18:38 ` Lars Ingebrigtsen
@ 2021-01-27 14:08 ` Harald Jörg
2021-01-28 3:23 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Harald Jörg @ 2021-01-27 14:08 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46024, 積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> writes:
> [...]
> Long term, it does seem like the best solution would be to have a
> separate mode for Raku, and not keep tweaking (c)perl-mode to add Raku
> features, I think.
>
> So backing out this change ('argument' etc) sounds like a good idea to
> me.
The attached patch removes the declarators and prefixes which are not in
Perl.
BTW: There is a Raku mode, maintained by the Raku team in their
repository on GitHub.
--
Cheers,
haj
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Remove non-Perl keywords --]
[-- Type: text/x-diff, Size: 1915 bytes --]
From 7fee0d96a94dfca5567efc757f5b38655e807787 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Harald=20J=C3=B6rg?= <haj@posteo.de>
Date: Wed, 27 Jan 2021 14:50:01 +0100
Subject: [PATCH] ; perl-mode.el: Eliminate keywords which are not in Perl.
* lisp/progmodes/perl-mode.el (perl-imenu-generic-expression):
Remove keywords which are not part of Perl.
(perl-font-lock-keywords-2): Remove keywords which are not part of
Perl.
---
lisp/progmodes/perl-mode.el | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index d047dd543c..0120e4a7cd 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -143,7 +143,7 @@ perl-imenu-generic-expression
'(;; Functions
(nil "^[ \t]*sub\\s-+\\([-[:alnum:]+_:]+\\)" 1)
;;Variables
- ("Variables" "^[ \t]*\\(?:anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1)
+ ("Variables" "^[ \t]*\\(?:has\\|local\\|my\\|our\\|state\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1)
("Packages" "^[ \t]*package\\s-+\\([-[:alnum:]+_:]+\\);" 1)
("Doc sections" "^=head[0-9][ \t]+\\(.*\\)" 1))
"Imenu generic expression for Perl mode. See `imenu-generic-expression'.")
@@ -188,9 +188,8 @@ perl-font-lock-keywords-2
"\\>")
;;
;; Fontify declarators and prefixes as types.
- ("\\<\\(anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\>" . font-lock-type-face) ; declarators
- ("\\<\\(let\\|temp\\)\\>" . font-lock-type-face) ; prefixes
- ;;
+ ("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-type-face) ; declarators
+ ;;
;; Fontify function, variable and file name references.
("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
;; Additionally fontify non-scalar variables. `perl-non-scalar-variable'
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#46024: Perl mode colors the word "argument" funny [PATCH]
2021-01-27 14:08 ` bug#46024: Perl mode colors the word "argument" funny [PATCH] Harald Jörg
@ 2021-01-28 3:23 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28 3:23 UTC (permalink / raw)
To: Harald Jörg; +Cc: 46024, 積丹尼 Dan Jacobson
haj@posteo.de (Harald Jörg) writes:
> The attached patch removes the declarators and prefixes which are not in
> Perl.
Thanks; applied to Emacs 28.
> BTW: There is a Raku mode, maintained by the Raku team in their
> repository on GitHub.
I see... and checking with `package-list', it's also on Melpa.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-28 3:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-21 20:05 bug#46024: Perl mode colors the word "argument" funny 積丹尼 Dan Jacobson
2021-01-22 0:33 ` Harald Jörg
2021-01-22 18:38 ` Lars Ingebrigtsen
2021-01-27 14:08 ` bug#46024: Perl mode colors the word "argument" funny [PATCH] Harald Jörg
2021-01-28 3:23 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).