From sesquile at gmail.com Wed May 11 00:44:53 2011 From: sesquile at gmail.com (m h) Date: Tue, 10 May 2011 16:44:53 -0600 Subject: [Python-mode] code/macros to reformat code Message-ID: Folks- I was wondering if anyone has some code floating around to reformat code after the code passes a certain column (say 79 or 80). What I'm looking for is reformatting long lines. I'd like to convert something like (assume the k of junk is around 78): my_string = "foo bar baz ... junk stuff etc" to: my_string = "foo bar baz ... junk" "stuff etc" My searches have turned up nothing, but I'm assuming someone has something. cheers, -matt From andreas.roehler at online.de Wed May 11 08:20:45 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Wed, 11 May 2011 08:20:45 +0200 Subject: [Python-mode] code/macros to reformat code In-Reply-To: References: Message-ID: <4DCA2ABD.8070202@online.de> Am 11.05.2011 00:44, schrieb m h: > Folks- > > I was wondering if anyone has some code floating around to reformat > code after the code passes a certain column (say 79 or 80). > > What I'm looking for is reformatting long lines. I'd like to convert > something like (assume the k of junk is around 78): > > my_string = "foo bar baz ... junk stuff etc" > > to: > > my_string = "foo bar baz ... junk" > "stuff etc" > Hi, assume your result must read: my_string = """foo bar baz ... junk stuff etc""" The only way I see is transferring quotes into triple-quotes, in case py-fill-string takes action. Andreas > My searches have turned up nothing, but I'm assuming someone has something. > > cheers, > -matt > _______________________________________________ > Python-mode mailing list > Python-mode at python.org > http://mail.python.org/mailman/listinfo/python-mode > From sesquile at gmail.com Wed May 11 18:24:32 2011 From: sesquile at gmail.com (m h) Date: Wed, 11 May 2011 10:24:32 -0600 Subject: [Python-mode] code/macros to reformat code In-Reply-To: <4DCA2ABD.8070202@online.de> References: <4DCA2ABD.8070202@online.de> Message-ID: On Wed, May 11, 2011 at 12:20 AM, Andreas R?hler wrote: > Am 11.05.2011 00:44, schrieb m h: >> >> Folks- >> >> I was wondering if anyone has some code floating around to reformat >> code after the code passes a certain column (say 79 or 80). >> >> What I'm looking for is reformatting long lines. I'd like to convert >> something like (assume the k of junk is around 78): >> >> my_string = "foo bar baz ... junk stuff etc" >> >> to: >> >> my_string = "foo bar baz ... junk" >> ? ? ? ? ? ? ? ? ? ? ?"stuff etc" >> > > Hi, > > assume your result must read: > > my_string = """foo bar baz ... junk > ? ? ? ? ? ? stuff etc""" > > The only way I see is transferring quotes into triple-quotes, in case > py-fill-string takes action. > Nope, my example meant what I wrote. I don't want the newlines that triple quoted strings would bring with it. I want to split up a longer than 80 (or what have you) string into multiple lines. cheers, -matt From andreas.roehler at online.de Thu May 12 08:39:34 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Thu, 12 May 2011 08:39:34 +0200 Subject: [Python-mode] code/macros to reformat code In-Reply-To: References: <4DCA2ABD.8070202@online.de> Message-ID: <4DCB80A6.3020509@online.de> Am 11.05.2011 18:24, schrieb m h: > On Wed, May 11, 2011 at 12:20 AM, Andreas R?hler > wrote: >> Am 11.05.2011 00:44, schrieb m h: >>> >>> Folks- >>> >>> I was wondering if anyone has some code floating around to reformat >>> code after the code passes a certain column (say 79 or 80). >>> >>> What I'm looking for is reformatting long lines. I'd like to convert >>> something like (assume the k of junk is around 78): >>> >>> my_string = "foo bar baz ... junk stuff etc" >>> >>> to: >>> >>> my_string = "foo bar baz ... junk" >>> "stuff etc" >>> >> >> Hi, >> >> assume your result must read: >> >> my_string = """foo bar baz ... junk >> stuff etc""" >> >> The only way I see is transferring quotes into triple-quotes, in case >> py-fill-string takes action. >> > > Nope, my example meant what I wrote. I don't want the newlines that > triple quoted strings would bring with it. I want to split up a longer > than 80 (or what have you) string into multiple lines. > > cheers, > -matt > Hmm, if you change my_string = "foo bar baz ... junk stuff etc" into: my_string = "foo bar baz ... junk" "stuff etc" then "stuff etc" will not be assigned to my_string any more. Are you prepared to give it up? If not, please deliver an example with a working final state... Cheers, Andreas From david at deadpansincerity.com Thu May 12 10:01:42 2011 From: david at deadpansincerity.com (David Miller) Date: Thu, 12 May 2011 09:01:42 +0100 Subject: [Python-mode] code/macros to reformat code In-Reply-To: <4DCB80A6.3020509@online.de> References: <4DCA2ABD.8070202@online.de> <4DCB80A6.3020509@online.de> Message-ID: > > > my_string = "foo bar baz ... junk" > "stuff etc" > > > then "stuff etc" will not be assigned to my_string any more. > (Possibly) worse than that, it's going to throw an IndentationError :) Have you tried M-x longlines-mode ? -- Love regards etc David Miller http://www.deadpansincerity.com 07854 880 883 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.roehler at online.de Fri May 20 13:41:32 2011 From: andreas.roehler at online.de (=?ISO-8859-15?Q?Andreas_R=F6hler?=) Date: Fri, 20 May 2011 13:41:32 +0200 Subject: [Python-mode] execfile Message-ID: <4DD6536C.3020309@online.de> Hi Barry, think we should get the execfile issue fixed with next release too. patch at https://bugs.launchpad.net/python-mode/+bug/310354 reads good for me. Remaining question: Exists a danger it may break something backward? If yes: What about introducing a var indicating the python version the code is intended to? In case that var isn't set, the python version which py-execute-region would call, may be queried on the fly. Should I look for this? Cheers, Andreas From donald-curtis at uiowa.edu Wed May 25 16:51:30 2011 From: donald-curtis at uiowa.edu (Donald Ephraim Curtis) Date: Wed, 25 May 2011 09:51:30 -0500 Subject: [Python-mode] What is the current status of python-mode? Message-ID: when I try to insert an "if" statement emacs throws an exception that "python-skeleton-if" cannot be found. is the repo in a bad state and something people can contribute to? reviewing the mailing list didn't indicate anything out of the ordinary. am I doing something wrong? From andreas.roehler at online.de Wed May 25 18:42:46 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Wed, 25 May 2011 18:42:46 +0200 Subject: [Python-mode] What is the current status of python-mode? In-Reply-To: References: Message-ID: <4DDD3186.6020107@online.de> Am 25.05.2011 16:51, schrieb Donald Ephraim Curtis: > when I try to insert an "if" statement emacs throws an exception that "python-skeleton-if" cannot be found. > > is the repo in a bad state and something people can contribute to? reviewing the mailing list didn't indicate anything out of the ordinary. am I doing something wrong? > _______________________________________________ Hi, could you tell which python-mode version and which Emacs version you are using? An entry in the bug tracker might assist fixing: https://bugs.launchpad.net/python-mode For the moment: disabling abbrev-mode in that buffer should help. Regards, Andreas From andreas.roehler at online.de Wed May 25 22:05:59 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Wed, 25 May 2011 22:05:59 +0200 Subject: [Python-mode] What is the current status of python-mode? In-Reply-To: References: Message-ID: <4DDD6127.5030108@online.de> Am 25.05.2011 16:51, schrieb Donald Ephraim Curtis: > when I try to insert an "if" statement emacs throws an exception that "python-skeleton-if" cannot be found. > > is the repo in a bad state and something people can contribute to? reviewing the mailing list didn't indicate anything out of the ordinary. am I doing something wrong? > _______________________________________________ Hi, checked in a fix, which should keep the python.el abbrevs/templates away. Could you try the current trunk? Thanks, Andreas