From: "Harald Jörg" <haj@posteo.de>
To: Corwin Brust <corwin@bru.st>
Cc: emacs-devel@gnu.org
Subject: Re: Enhancing cperl-mode
Date: Mon, 19 Jun 2023 16:41:22 +0000 [thread overview]
Message-ID: <87352nbe19.fsf@oook.m.uunet.de> (raw)
In-Reply-To: <CAJf-WoR5Rs3C4Gmy0Be56XpdhZu-N_72WK97BN3hyswO1j=dHQ@mail.gmail.com> (Corwin Brust's message of "Mon, 19 Jun 2023 09:58:46 -0500")
Corwin Brust <corwin@bru.st> writes:
> Wonderful seeing this.. we are clearly thinking along very similar
> lines! --more--
:D
> I'd be very happy to defer to your efforts; if you would like to take
> the lead on this I'm happy to help all I can, like please absorb what
> you will from my version. As you can see, I've not even bothered to
> fix trivial things like line length in my rush to see the new keywords
> "light up" :)
I'll then happily take your patch as an additional check list that I
haven't missed anything!
> [...]
>> Also, I've been dreaming of adding support for Perl's syntax
>> extensions as minor modes which can be activated on top of perl-mode and
>> cperl-mode.
>
> I have the same theory/vision.
>
> I have long term vision/hopes, and too, I've also been of adding
> support for syntax.pm keywords via minor-modes, probably via some new
> hooks? I have the idea of a "amada" of cperl-syntax-FOO minor modes
> mirroring the CPAN modules using syntax.pm.
...or more generally, stuff like Moose where the "keywords" (has,
extends etc) technically are imported subroutines, but they "feel" like
keywords.
> I hooks call while
> setting up font-locking could be a feasible way, but I'm still trying
> to parse the parsing (sorry if I crashed ur tokenizer there). More
> specifically, I'm not clear on the interaction/use subrs vs calling
> hooks to add/tweak font-locking and what all, exactly, is happening at
> compile time. (Is this effectively impossible? Will we wreck
> performance?)
>
> I do know I haven't found an incantation to make updating the
> font-lock setup "live"; I have to re-launch Emacs as I go to test
> these changes.
For font-locking, there are two mechanisms which can be used by minor
mode hooks: First, there's font-lock-add-keyword /
font-lock-remove-keyword which works for all, well, "keywords" (which
most of the syntax extensions provide). Second, the MATCHER in
font-lock can be a function (as already used in the ominous
cperl-fontify-update) which can work on variables which in turn can be
modified by minor modes, or even hooked into. So yes, it can be done
"live", but it needs preparation. I made a proof-of-concept, but the
implementation is crap. It still hangs around at
https://github.com/HaraldJoerg/cperl-mode/, but I more or less stopped
working on it when I started to contribute to the savannah repository.
Open a file which uses Moose, or Zydeco, or Function::Parameters, or any
of the keyword sets it understands... and it automatically highlights
the extensions. Instead of minor modes it uses commands
cperl-activate-keyword-set, cperl-deactivate-keyword-set, and
cperl-reset-keyword-sets. This is a bad idea, but back then I didn't
understand minor modes.
I'm a bit stuck with indentation, where the code in cperl-mode is
messy. Keywords that are followed by a { code block } sometimes need a
semicolon, and sometimes they don't, and cperl-mode needs to understand
this in order to decide whether the next line is a continuation line or
a new statement.
> Excited to hear the extent you'd like to work on this!
I am interested to work on this, only have been distracted a lot by
non-elisp projects. The upcoming Perl 5.38 made me re-activate my elisp
activities. I'm also interested to get cperl-mode published via ELPA,
so that it can be used once Perl 5.38 is out.
--
Cheers,
haj
next prev parent reply other threads:[~2023-06-19 16:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-18 10:14 Does Emacs need two Perl modes? Peter Oliver
2023-06-18 12:15 ` Po Lu
2023-06-18 12:56 ` Jens Schmidt
2023-06-19 13:01 ` Corwin Brust
2023-06-19 14:34 ` Enhancing cperl-mode (was: Re: Does Emacs need two Perl modes?) Harald Jörg
2023-06-19 14:58 ` Corwin Brust
2023-06-19 16:41 ` Harald Jörg [this message]
2023-06-19 21:49 ` Enhancing cperl-mode Corwin Brust
2023-06-20 2:57 ` Does Emacs need two Perl modes? Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87352nbe19.fsf@oook.m.uunet.de \
--to=haj@posteo.de \
--cc=corwin@bru.st \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.