[Israel.pm] Completion and editors (offtopic)

Shlomi Bakish shlomi at il.marvell.com
Wed Jun 9 00:49:05 PDT 2004

I use gvim , I'm happy with it and the the syntax coloring,
does it support auto-completion (sounds very efficient ...)
what do I need to make it work for me ?

Yuval Yaari wrote:

> Mikhael Goikhman wrote:
>> Yuval, I don't think you may convince me auto-completion is any good.
>> Really, it is slow (type, resolve conflicts), inconvenient (find your
>> choice in the long list of all global and local variables), helpless
>> (you can't see the variable description, or the code it is used in) and
>> distracts from actual coding. It is very editor dependent. If the editor
>> (I guess ctags is used here) fails to parse the Perl code, you are
>> screwed, because you forgot to think on your own, you are the editor
>> slave now. Joking.
> And I assume closing your editor, opening a new one, looking for that 
> variables, getting back to the first editor, and pasting the variable 
> is much better..?
> This sounds like it should distract you from your code.
> Auto-completion works without you even moving your eyes from the line 
> you're working on.
> That's why I like it.
> Also, just try to split the window, should be much easier for you.
> I'm just trying to understand how auto-completion, which improved my 
> development (time and "correctness" [i.e: I always get a real variable 
> name - never fails use strict;]), might be the wrong choice.
>> It is wrong that emacs and vim parse Perl correctly. At least in the
>> versions I have installed, emacs does not even colorize /regexp/, and it
>> screws /reg"exp/ completely (the rest of the file is randomly 
>> colorized).
>> vim does not handle s at regexp@replace@ and many other cases. And even if
>> these cases are fixed in the latest versions, I may always find the code
>> to fail. Usually my code is always incorrectly colorized, probably
>> because I don't use these editors and never test how they display it.
>> I think many people perform a lot of irrelevant workarounds to make
>> their editors happy. "Smart" editors are almost always a bad idea.
> Use notepad. It has all the features you need.
> I personally require much more of a program that I use on a daily 
> basis, and basically, all day long.
>> You are wrong that my editor supports auto-completion, it did not even
>> support colorizing up until now, and I didn't miss it at all. I use the
>> customized joe editor, it is not graphical and not smart, it just does
>> everything I want in a moment.
> Ok, so some editors (joe and notepad... pico...) do not do it.
> Why would you use such a featureless editor, I don't know.
> I bet your code (indention - wise) is horrible as a side effect :)
> All I have to do is just press RETURN and my editor indents the next 
> line for me.
> As I said, your editor should make you focus on the serious stuff, and 
> not how many TABS (or spaces) you need to press to get the line 
> indented well.
> Same thing as for auto-completion.
>> As for having to find the place where the variable is declared or 
>> used in
>> order to copy it. Yes, I find this a very good practice if you actually
>> want to ensure you use the correct variable/function. It is like 
>> browsing
>> the man page before using something. This task can't be automated. It
>> takes me about 5 seconds to find the relevant code. Sometimes I do this
>> by escaping to shell (Ctrl-Z) and running grep or another temporary joe.
>> Here file completion is a must, unlike variable completion.
> Again, I used to do it.
> I found auto-completion weird, not comfortable, etc.
> But now that I'm used to it it's MUCH faster and easier.
> Also, I stay focused on my code.
> And if your variables don't have clear names, you're in big troubles.
> Did I mention that grep should integrate into your editor? :)
> As for being perfectly certain that you're using the right variable, I 
> would from time to time split the window, and in one window go looking 
> for that variable.
> If, for example, I use a set of the same 5 variables over 10 lines, 
> copy-pasting wouldn't be as effecient as auto-completion.
> Especially after you're certain of the variable names, etc.
> Please don't tell me you'd use Klipper for this, this is also not 
> effecient.
> What you're describing is a case where you force yourself into working 
> in stupid ways because of your editor, instead of just finding the 
> right tool.
> And yes, I find leaving the editor and opening a new one stupid.
> At least your editor should let you split the damn window.
>> I think I know why you may not like copy/paste. It is pretty 
>> inconvenient
>> in most of the graphical editors, because they move the cursor when you
>> copy a text, at least by default. It is much more convenient in pure
>> xterm. Start a non graphical emacs with $DISPLAY unset to see what I am
>> speaking about. The whole copy/paste in xterm is just "copy anywhere
>> (does not move the cursor)", "press middle mouse to paste". Sometimes 
>> the
>> thing to copy is in the previous page, so you may want to press 
>> PgDn/PgUp
>> before and after copying. Here emacs and vim fail completely again, PgDn
>> + PgUp do not restore the original cursor position as expected, and 
>> there
>> is no option to do it right (in vim you may use virtualedit, but this is
>> not a solution).
> Who said I'm using Emacs? :)
> Ok... Who said I'm using graphical Emacs?
> And xterm reeks.
> I use Konsole and I use emacs -nw. Always.
> You're talking nonsense as for the PgDn PgUp thing (I just tried it), 
> and also, using auto-completion, I would never have to use PgUp PgDn 
> in the first place!
> And you said auto-completion gets you out of focus, I bet your mind 
> work really well with all those PgUps/PgDns.
> At least don't say you stay focues on your code, because you can't be, 
> while exiting the editor 2000 times a day, greping/opening a new 
> editor, copying, returning to the editor, and pasting (PgUp/PgDn too 
> ...).
> Can't you see it's the most hack-ish way into finding the variable you 
> want?
> Also, that works for 1 variable at a time.
> All I do is type something like this:
> print $Ca[M-/], "\n";
> And what I get is:
> print $CarColor, "\n";
> Of course I press M-/ untill I reach my goal.
> This keeps me really focused on the original line (which usually is 
> more complex than this example :)).
> To be honest, I hardly even have to think (not the MS-Windows kind of 
> way, though) about it - I just make sure the variable is what I want.
> Either I give good names, or I take a glance using split-windows, etc 
> - but I don't have to do it all the time, especially after I already 
> know the name of the variable I want.
> After all, how many times would you want to use a variable that you 
> have no idea of its name?
> Even when I do want to copy-paste, my editor lets me do it withouth 
> leaving the current line and without leaving the current window.
> So let me know how you stay focused this way, especially when you need 
> to copy-paste a set of more than 1 variable.
> Please elaborate on how this is more effecient, or better, than 
> auto-completion in terms of staying focused on your code.
> I might be wrong!
>> Ok, let's stop here otherwise I will suggest to disable auto-indentation
>> in your editor completely just because it never works correctly. :)
> It always works correctly - esp. if you give good names to your 
> variables.
> $tmp_* $migo_* and $naxuy_* are bad names :)
>  --Yuval
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/mailman/listinfo/perl

More information about the Perl mailing list