473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

"Smart" Block Copy & Paste


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
2 4247
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Martin Goldman | last post by:
Hello all, I've been struggling for a few days with the question of how to convert "smart" (curly) quotes into straight quotes. I tried playing with the htmlentities() function, but all that is...
14
by: David B. Held | last post by:
I wanted to post this proposal on c.l.c++.m, but my news server apparently does not support that group any more. I propose a new class of exception safety known as the "smart guarantee". ...
11
by: Ron | last post by:
Hello, I'm having an aggravating time getting the "html" spewed by Word 2003 to display correctly in a webpage. The situation here is that the people creating the documents only know Word, and...
2
by: BobAchgill | last post by:
Is there a way to let the User click on a button on a web site and have that download and install my prepackaged compressed data directory and place it nicely under my existing VB .Net Form...
3
by: red floyd | last post by:
I've got some code where somebody cut&pasted some comments from MS Word, and so these comments have "smart quotes" (in particular apostrophes) embedded. The apostrophe is character hex 0x92. ...
5
by: Noozer | last post by:
I'm looking for a "smart folder" program to run on my Windows XP machine. I'm not having any luck finding it and think the logic behind the program is pretty simple, but I'm not sure how I'd...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.