Re: [EMACS-PERL] PerlySense (was: SPAM & perlysense)

20 views
Skip to first unread message

Joe Brenner

unread,
Dec 3, 2009, 7:40:46 PM12/3/09
to emacs-perl-...@googlegroups.com

Forwarding with permission a reply from Johan Lindstrom (with
an umlaut on the last o there, of course):

Date: Tue, 1 Dec 2009 11:46:43 +0000
Subject: Re: [EMACS-PERL] PerlySense (was: SPAM & perlysense)
From: Johan Lindstrom <buzzwo...@googlemail.com>
To: Joe Brenner <do...@kzsu.stanford.edu>

Joe Brenner <do...@kzsu.stanford.edu>:

>> indeed already when starting up emacs it takes very long to load perlysense

Not that's it's an excuse, but it's probably the first time you load
all the modules, so a lot of source files aren't in the file system
cache.

OTOH, how often do you launch Emacs? I start it every two weeks, tops :)


>> and I still have a problem using it with emacs23.

That's weird, I run it in 23, and previously in 22.

What specifically is not working?


> Hm... I've been doing okay with a recent cvs build (and perl 5.10.0).
>
> I don't re-start emacs very often, myself... I was talking about how
> long some of the commands can take to run. Since it shells out to perl
> all the time, you can hit a keystroke and then have to wait a few seconds.

There are two things you can do to make things be quicker.

1. Enable flymake + Perl::Critic. This will parse the document using
PPI continuously, and when you need to do anything, the PPI document
is already cached.

2. Enable
(setq ps/use-prepare-shell-command t)
as mentioned in
<http://search.cpan.org/~johanl/Devel-PerlySense-0.0183/lib/Devel/PerlySense.pm#Emacs_installation>

This will pre-launch the perly_sense binary to avoid the loong startup
time imposed by loading all modules.


Personally, the parts of PerlySense I use most extensively are:
- Run tests, and everything around that, including fixing test counts.
- Go to certain buffers: Version control, *compilation* etc.
- Find with ack, specifically subs and method invocants
- Goto module
- Goto base class
- Document Inheritance

In my previous work project, I used Code Coverage display and
navigation a lot, but that's not set up for what I do now.

So, I don't use the PPI stuff so much. I do believe it's partly
because of the slowness.


> Thus far I'm most impressed with the "Class Overview" buffer...
> If I'm editing an object-oriented module, I can hit
>
> C-c , C-o
>
> And it brings up a summary of all available methods, including ones
> inherited from other classes. If you move to one of the methods and
> hit return, it jumps you to the place in the code where it's defined.

It is pretty nice, but needs to be pre-generated or use a metadata
store to be instant and hence actually usable.

I rarely use it, but it's extremely useful occasionally when I need to
get a grasp of a class. Most of the time Document Inheritance is good
enough, and a bit faster (C-o d i).


>> > and finding keybindings to use it with is proving to be a pain for me
>> > (I tried using their recommended C-o prefix, and discovered how often
>> > I use open-line...).

Fair enough :) That's just my personal preference, and not without
problems. I'd go with a C-c prefix if I were you. I use PerlySense
stuff often enough for C-c to be a tiny bit too awkward.

Joe Brenner

unread,
Dec 3, 2009, 8:15:33 PM12/3/09
to emacs-perl-...@googlegroups.com

<buzzwo...@googlemail.com> wrote:

> Joe Brenner <do...@kzsu.stanford.edu>:
> >> indeed already when starting up emacs it takes very long to load perlysense
>
> Not that's it's an excuse, but it's probably the first time you load
> all the modules, so a lot of source files aren't in the file system
> cache.
>
> OTOH, how often do you launch Emacs? I start it every two weeks, tops :)

Myself, I re-start emacs as infrequently as possible. That used to mean
uptimes of months, but lately I've been re-starting it more frequently
(when top tells me it's eating a lot of memory).

But I know people who're stuck working remotely over flaky network
connections, and/or with network disk drives that can respond slowly...
I speculate that perlysense might seem too heavy-weight under those
conditions.

> >> and I still have a problem using it with emacs23.
>
> That's weird, I run it in 23, and previously in 22.
>
> What specifically is not working?

I don't know myself... Rolf?

> > Hm... I've been doing okay with a recent cvs build (and perl 5.10.0).
> >
> > I don't re-start emacs very often, myself... I was talking about how
> > long some of the commands can take to run. Since it shells out to perl
> > all the time, you can hit a keystroke and then have to wait a few seconds.
>
> There are two things you can do to make things be quicker.
>
> 1. Enable flymake + Perl::Critic. This will parse the document using
> PPI continuously, and when you need to do anything, the PPI document
> is already cached.
>
> 2. Enable
> (setq ps/use-prepare-shell-command t)
> as mentioned in
> <http://search.cpan.org/~johanl/Devel-PerlySense-0.0183/lib/Devel/PerlySense.pm#Emacs_installation>
>
> This will pre-launch the perly_sense binary to avoid the loong startup
> time imposed by loading all modules.

Okay, sounds like those are worth playing with.

I haven't yet seen the coolness of flymake, by the way... I've been
working on my own way of doing these things (perlnow.el) and I
gravitated toward seperate manual commands to "check" and "run" the
code... a check is just a syntax check (perl -cw) or if run with C-u,
it also invokes podchecker and perlcritic. What it means to "run" some
code can vary, but often it means running test(s).

> Personally, the parts of PerlySense I use most extensively are:
> - Run tests, and everything around that, including fixing test counts.

Yeah, I just hacked in a feature to perlnow.el to revise test counts.
I thought it was funny you have one too.

> - Go to certain buffers: Version control, *compilation* etc.

I haven't quite gotten what the VC front-end is for, but then I'm
still a beginner with git.

(The only nav feature in perlnow.el, by the way, is a command that takes
you from the current code file to an associated code file... the
perlnow.el workflow works in terms of pairs of files, e.g. a module
and a test script.)

> - Find with ack, specifically subs and method invocants

Yeah, I wrote a simple one of those awhile back. I see that there's an
ack.el out there now, too.

> - Goto module
> - Goto base class
> - Document Inheritance
>
> In my previous work project, I used Code Coverage display and
> navigation a lot, but that's not set up for what I do now.

That feature looks like fun. I haven't played with it yet, myself.
(I still haven't got in the habit of doing code coverage checks...
I think I generally know how good or bad my coverage is.)

> So, I don't use the PPI stuff so much. I do believe it's partly
> because of the slowness.

I was thinking about investigating PPI as a way of doing better
auto-completion.

> > Thus far I'm most impressed with the "Class Overview" buffer...
> > If I'm editing an object-oriented module, I can hit
> >
> > C-c , C-o
> >
> > And it brings up a summary of all available methods, including ones
> > inherited from other classes. If you move to one of the methods and
> > hit return, it jumps you to the place in the code where it's defined.
>
> It is pretty nice, but needs to be pre-generated or use a metadata
> store to be instant and hence actually usable.
>
> I rarely use it, but it's extremely useful occasionally when I need to
> get a grasp of a class. Most of the time Document Inheritance is good
> enough, and a bit faster (C-o d i).

Okay, I'll play around with it.

> >> > and finding keybindings to use it with is proving to be a pain for me
> >> > (I tried using their recommended C-o prefix, and discovered how often
> >> > I use open-line...).
>
> Fair enough :) That's just my personal preference, and not without
> problems. I'd go with a C-c prefix if I were you. I use PerlySense
> stuff often enough for C-c to be a tiny bit too awkward.

In the early days of perlnow.el I gravitated to "C-c /" in order to play
by the gnuemacs rules... I didn't find it too hard to get used to (and
I'm glad I abandoned my original choice of "C-c '", which is marginally
harder to type. "C-c ," seemed like a good choice for perlysense (the ","
being two keys over from the "/", instead of the "." which is right next
door).

I have a suggestion about key-definition UI, by the way... I prefer to
leave the key-map untouched unless the user explicitly okays the changes.
I like a function where the prefix is an optional argument:

(require 'perlnow)
(perlnow-define-standard-keymappings "\M-o")

LanX

unread,
Dec 4, 2009, 7:48:13 AM12/4/09
to Joe Brenner, emacs-perl-...@googlegroups.com
> That's weird, I run it in 23, and previously in 22.
>
> What specifically is not working?

I don't know myself... Rolf?


Never mind. I just realized that the installation of this instance of emacs23 was never completed. (I was debugging a problem with cperl-mode and compile.el)

Sorry, a little occupied at the moment, later more! 8)
 

Cheers
  rolf


Reply all
Reply to author
Forward
0 new messages