--------------------------------------------------------------------
3.12: Where can I get perl-mode for emacs?
Since Emacs version 19 patchlevel 22 or so, there have been both a
perl-mode.el and support for the Perl debugger built in. These should
come with the standard Emacs 19 distribution.
In the Perl source directory, you'll find a directory called "emacs",
which contains a cperl-mode that color-codes keywords, provides
context-sensitive help, and other nifty things.
Note that the perl-mode of emacs will have fits with "main'foo" (single
quote), and mess up the indentation and highlighting. You are probably
using "main::foo" in new Perl code anyway, so this shouldn't be an
issue.
--------------------------------------------------------------------
The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.
If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.
This advice is outdated, because 'cperl-mode.el' is now part of the
Emacs distribution, so it's not necessary to look in the Perl source
directory.
> Working code is greatly appreciated.
I add the following line to Emacs to make cperl the default:
(defalias 'perl-mode 'cperl-mode)
I also have the following defaults:
(setq cperl-indent-level 4
cperl-close-paren-offset -4
cperl-brace-offset -4
cperl-label-offset 0
cperl-continued-statement-offset 4
cperl-tab-always-indent t)
In article <fv8e6n$rs2$1...@ml.accsnet.ne.jp>, Ben Bullock
<benkasmi...@gmail.com> wrote:
> PerlFAQ Server <br...@stonehenge.com> wrote:
> >
> > In the Perl source directory, you'll find a directory called "emacs",
> > which contains a cperl-mode that color-codes keywords, provides
> > context-sensitive help, and other nifty things.
>
> This advice is outdated, because 'cperl-mode.el' is now part of the
> Emacs distribution, so it's not necessary to look in the Perl source
> directory.
Since I don't use emacs, perhaps you could rewrite the entire answer
for me :)
??? Emacs distribution contains a broken, unsupported version of
cperl-mode.el. The source directory contains a working (but
somewhat outdated) supported version.
Enough said,
Ilya
>> PerlFAQ Server <br...@stonehenge.com> wrote:
>> >
>> > In the Perl source directory, you'll find a directory called "emacs",
>> > which contains a cperl-mode that color-codes keywords, provides
>> > context-sensitive help, and other nifty things.
>>
>> This advice is outdated, because 'cperl-mode.el' is now part of the
>> Emacs distribution, so it's not necessary to look in the Perl source
>> directory.
>
> ??? Emacs distribution contains a broken, unsupported version of
> cperl-mode.el. The source directory contains a working (but
> somewhat outdated) supported version.
The current Emacs distribution (22.1) contains a version with a
copyright of 2007, which works very well - it isn't broken. I remember
that cperl mode was broken in the previous Emacs version, and the
Emacs distribution contained an old version which had to be
replaced. The 5.10.0 Perl sources contain a version of cperl-mode.el
with a copyright of 2006. The version numbers tell a different story,
with the one in the Emacs source having a version number of 5.22 and
the one in the Perl source having a version number of 5.23. A diff
produces a large number of results which indicate that a lot of
comments have been removed from the Emacs source tree version of
cperl-mode.el, and the results of wc (count the number of lines /
words / bytes command on Unix) give similar results:
$ wc *cperl*
2535 14198 105876 cperl-mode-diff
9041 36268 331296 emacs-source-cperl-mode.el
10441 44057 393631 perlsource-cperl-mode.el
22017 94523 830803 total
What it looks like is a fork. But the above comment about
cperl-mode.el in the Emacs tree being out of date and broken is
itself now out of date.
> Enough said,
Maybe not.
From when updating a copyright message counts as a maintainance?
>, which works very well - it isn't broken.
Says who? Do you monitor for bug reports, and how they are "fixed"?
> What it looks like is a fork. But the above comment about
> cperl-mode.el in the Emacs tree being out of date and broken is
> itself now out of date.
I have no idea what you want to say here...
Yours,
Ilya
>> The current Emacs distribution (22.1) contains a version with a
>> copyright of 2007
>
> From when updating a copyright message counts as a maintainance?
Obviously it doesn't, but the file at least appears to be newer than the one
in the Perl source code.
>>, which works very well - it isn't broken.
>
> Says who? Do you monitor for bug reports, and how they are "fixed"?
I'm only describing my own experience. It isn't "broken" in the sense of
being unuseable. I'm writing Perl code almost every day & using the
emacs-source cperl-mode.el, and have yet to notice any serious bugs. The
only thing which I've noticed is that it has an annoying habit of instantly
complaining if it can't find the end of a here string or regular expression,
which is kind of silly since usually one doesn't write the end of the thing
immediately after writing the beginning of it.
>> What it looks like is a fork. But the above comment about
>> cperl-mode.el in the Emacs tree being out of date and broken is
>> itself now out of date.
>
> I have no idea what you want to say here...
What I want to say I thought was clear, but apparently not. I raised the
issue of cperl-mode.el due to the FAQ question apparently being out of date.
If you have a different story, perhaps you can spell it out for us ignorant
people.
Anyway, you're the author of cperl-mode.el, something probably not many
people noticed from reading the discussion, so thank you for making this
mode, which is useful to me.
> Obviously it doesn't, but the file at least appears to be newer than the one
> in the Perl source code.
As I said, in-Perl version is more obsolete. On the other hand, it
causes much fewer problems.
> >>, which works very well - it isn't broken.
> >
> > Says who? Do you monitor for bug reports, and how they are "fixed"?
> I'm only describing my own experience. It isn't "broken" in the sense of
> being unuseable. I'm writing Perl code almost every day & using the
> emacs-source cperl-mode.el, and have yet to notice any serious bugs.
Given the bugs people report with Emacs' version (ALL of which are
fixed by switching to the "genuine" one), you must have pretty high
bugs tolerance...
> The only thing which I've noticed is that it has an annoying habit
> of instantly complaining if it can't find the end of a here string
> or regular expression, which is kind of silly since usually one
> doesn't write the end of the thing immediately after writing the
> beginning of it.
True. Do you have any idea how would I be able to detect this
situation? Point after start of construct and modified, or what?
Can one detect that the ELisp code is called from an async handler?
> >> What it looks like is a fork. But the above comment about
> >> cperl-mode.el in the Emacs tree being out of date and broken is
> >> itself now out of date.
> >
> > I have no idea what you want to say here...
> What I want to say I thought was clear, but apparently not. I raised the
> issue of cperl-mode.el due to the FAQ question apparently being out of date.
> If you have a different story, perhaps you can spell it out for us ignorant
> people.
I think I did.
> Anyway, you're the author of cperl-mode.el, something probably not many
> people noticed from reading the discussion, so thank you for making this
> mode, which is useful to me.
Noted, and very appreciated.
Yours,
Ilya