473,772 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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 4271
On 2003-10-14, Tim Hochberg <ti**********@i eee.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**********@i eee.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)dentin g 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
12324
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 doing is changing the smart quotes into nonsense characters. I also searched the web for quite a while and was unsuccessful in finding a solution. What puzzles me is that doing it the other way around is simple enough. For example, this works...
14
2686
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". Essentially, the smart guarantee promises to clean up resources whose ownership is passed into the function, for whatever defintion of "clean up" is most appropriate for the resource passed. Note that this is different from both the basic and the...
11
7045
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 aren't very computer savvy. I created a system where they can save their Word documents as "html" and upload them to a certain directory, and the web page dynamically runs them through tidylib using the tidy extension to php4, thus causing the...
2
2379
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 application on the User's computer? Maybe another way of asking the question is. Can I build a smart .msi "data" installer that will when clicked on as "Run" on the web page will load into the desktop's memory ... find the location of my VB .Net Form...
3
3228
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. 2.1 indicates that characters not in the source character set are converted to the universal character name that designates the character. So far, so good. The non-source character gets translated. No big deal.
5
2899
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 implement this. I've done some VB6 programming and dabbled in VS.Net. Can someone share some pointers in how I could implement the following? Basically, you drag a file to the "smart" folder and, depending on the type of file and settings for that...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.