By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,796 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,796 IT Pros & Developers. It's quick & easy.

"Smart" Block Copy & Paste

P: n/a

During the recent, massive, painful Lisp-Python crossposting thread the
evils of Python's whitespace based indentation were once again brought
to light. Since Python' syntax is so incredibly brittle, and failure
prone, it's amazing that we don't have more editor support for our
feeble minds. To help reduce the severity of this crisis, I decided to
take a whack at creating smart block copy and paste functionality.

Anyway, I wrote some code to extract indentation information from the
original file when doing copies and then to match up the indentation in
a sensible way when doing pastes. The code is still rough and can be
quite slow in some situations, but I figured it was interesting enough
to release. If your interested in trying it out or just getting more
details, the code and instructions for hacking it into Idle are
available at http://starship.python.net/crew/hochberg/

Regargs,

-tim

Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2003-10-14, Tim Hochberg <ti**********@ieee.org> wrote:
During the recent, massive, painful Lisp-Python crossposting thread the
evils of Python's whitespace based indentation were once again brought
to light. Since Python' syntax is so incredibly brittle, and failure
prone, it's amazing that we don't have more editor support for our
feeble minds.


Why, exactly, would we need more than << and >>?

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
Jul 18 '05 #2

P: n/a
Steve Lamb wrote:
On 2003-10-14, Tim Hochberg <ti**********@ieee.org> wrote:
During the recent, massive, painful Lisp-Python crossposting thread the
evils of Python's whitespace based indentation were once again brought
to light. Since Python' syntax is so incredibly brittle, and failure
prone, it's amazing that we don't have more editor support for our
feeble minds.

Why, exactly, would we need more than << and >>?


I assume that's block dedent and indent? You don't, really, need more
than that.

However, many editors tend to mess up the indentation on the first line
of a pasted block, which as to be corrected separately from the rest.
You can usually avoid this if your careful or hit home/ctrl-a/etc before
pasting, but that's extra keystrokes. Also, at least some editors
(SciTe, Idle) don't set the mark on your pasted text, so then you need
to select the pasted text before (in)|(de)denting it.

Of course what I did was probably massively overkill for these problems,
but it's an interesting project. Also, the behaviour of Idle with the
patch is overall better than without, IMO. In truth, I suspect that I
could get a similar gain with less invasive and simpler changes, but it
wouldn't be as intersting.

Regards,

-tim



Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.