From noreply at sourceforge.net Mon Nov 1 17:15:28 2004 From: noreply at sourceforge.net (SourceForge.net) Date: Mon Nov 1 17:15:34 2004 Subject: [Python-mode] [ python-mode-Patches-1023335 ] Handle triple-quoted strings correctly. Message-ID: Patches item #1023335, was opened at 2004-09-07 00:22 Message generated for change (Comment added) made by jlgijsbers You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581351&aid=1023335&group_id=86916 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Edward Loper (edloper) Assigned to: Nobody/Anonymous (nobody) Summary: Handle triple-quoted strings correctly. Initial Comment: This patch adds an option that will color triple-quoted strings correctly. It works by turning off syntax-highlighting for strings and comments (by registering quotes and hashes in the syntax table as normal punctuation); and using a fairly advanced keyword matcher to find all strings and comments. The keyword matcher uses a text- property to keep track of the syntax category of each character, and only updates it as needed. Therefore, the option can only be used if text-properties are available (but they are available on all current versions of emacs, as far as I know). Caveat: it's possible that this will be slow on some machines, or under certian circumstances. But it's not noticably slower on the machines & files I've tested it on. ---------------------------------------------------------------------- Comment By: Johannes Gijsbers (jlgijsbers) Date: 2004-11-01 17:15 Message: Logged In: YES user_id=469548 I applied this patch to the latest python-mode and while triple-quoted-strings mostly work fine (thank you! thank you! thank you!), comments seem to be a bit broken. Take a look at BaseHTTPServer.py from the Python CVS for a particularly bad example. I'm running "GNU Emacs 21.3.50.1 (i386-pc-linux-gnu, GTK+ Version 2.4.10) of 2004-10-11 on surfboy, modified by Debian", compiled from Emacs CVS using the emacs-snapshot package. ---------------------------------------------------------------------- Comment By: Edward Loper (edloper) Date: 2004-09-07 04:15 Message: Logged In: YES user_id=195958 So I did. Trying again. ---------------------------------------------------------------------- Comment By: Skip Montanaro (montanaro) Date: 2004-09-07 03:41 Message: Logged In: YES user_id=44345 Edward, perhaps you forgot to check the box when uploading the patch? There's nothing currently attached to this item. -Skip ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581351&aid=1023335&group_id=86916 From Fernando.Perez at colorado.edu Fri Nov 5 06:22:21 2004 From: Fernando.Perez at colorado.edu (Fernando Perez) Date: Sat Nov 6 12:19:42 2004 Subject: [Python-mode] Patched python-mode with IPython support Message-ID: <418B0E0D.3050905@colorado.edu> Dear Python-mode maintainers, the attached code is a patched version of python-mode 4.62, which incorporates some changes to allow python-mode to support ipython[1] instead of the default python interpreter in (X)emacs. The work was done by Alex Schmolck and Prabhu Ramachandran, and over time ipython has distributed this specially patched version (since python-mode 4.22) to support ipytho's users. It would be great if these changes could be folded into the python-mode mainline code. As far as I understand, the changes are fairly unobtrusive for normal python users, and they would benefit greatly ipython's user base. Best regards, Fernando Perez [1] http://ipython.scipy.org Below follows the original message from Prabhu regarding this work. -------- Original Message -------- Subject: Re: [IPython-user] ipython + emacs py-execute-region problem. Date: Fri, 15 Oct 2004 15:23:25 +0530 From: Prabhu Ramachandran To: Fernando Perez CC: Bo Peng , ipython-user@scipy.net References: <6ea7b543041014093632091eb@mail.gmail.com> <416F6CB9.9040005@colorado.edu> <16751.32181.153111.604247@monster.linux.in> <416F7EEC.9010709@colorado.edu> >>>>> "FP" == Fernando Perez writes: >> Well, I think Bo means that this does not seem to happen if he >> uses Alex's python-mode but does not use ipython. So it >> appears that something funky happens when ipython is used. I >> am not elisp guru either to be able to help. When will Alex be >> back? FP> Oh, I misunderstood things then. My point about the lag in FP> the ipython-compatible version of python-mode being an FP> unpleaseant situation remains, though. FP> I think Alex said a month, and he only left a few days ago. Nevermind, I have fixed the problem. I've updated python-mode.el to the latest version (revision 4.62) available from CVS here: http://cvs.sourceforge.net/viewcvs.py/python-mode/python-mode/ I've retained Alex's fixes for IPython support in this version. I have also added a defcustom for py-shell-switch-buffers-on-execute which defaults to true and will therefore switch buffers to the py-shell when you execute a region. If you turn it off it disables this behavior. So, switching the buffer was a feature and not a bug, it appears. So, to get Bo's desired behavior you simply need to do this in your .xemacs/init.el: (require 'python-mode) (setq py-shell-switch-buffers-on-execute nil) (require 'ipython) Please find attached a gzipped file containing the new-and-improved python-mode.el. I think you could consider sending this in to python-mode@python.org. I'm not doing it since I have already spent a little too much time on this today. cheers, prabhu -------------- next part -------------- A non-text attachment was scrubbed... Name: python-mode.el.gz Type: application/octet-stream Size: 43659 bytes Desc: not available Url : http://mail.python.org/pipermail/python-mode/attachments/20041104/c0515123/python-mode.el-0001.obj From noreply at sourceforge.net Wed Nov 10 20:12:47 2004 From: noreply at sourceforge.net (SourceForge.net) Date: Wed Nov 10 20:12:50 2004 Subject: [Python-mode] [ python-mode-Patches-1064058 ] Two minor tweaks to python-mode Message-ID: Patches item #1064058, was opened at 2004-11-10 21:12 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581351&aid=1064058&group_id=86916 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Rory Yorke (ryorke) Assigned to: Nobody/Anonymous (nobody) Summary: Two minor tweaks to python-mode Initial Comment: python-mode has two slightly annoying behaviours, which this patch attempts to address: 1) py-shell always changes mode-name of buffer This happens because py-toggle-shells changes mode-name regardless of what it was before (e.g., invoke py-shell from a Elisp-mode buffer, mode-name becomes Python). 2) py-shell always switches to a new window This happens even if py-shell is invoked when the *Python* buffer is the active buffer; one then ends up with two windows showing the *Python* buffer. The patch is against python-mode.el revision 4.67. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581351&aid=1064058&group_id=86916 From pipehappy at gmail.com Wed Nov 17 10:05:01 2004 From: pipehappy at gmail.com (pipehappy) Date: Wed Nov 17 10:05:25 2004 Subject: [Python-mode] a simple question Message-ID: Hi! I an new in python and emacs. It says control-c | can send the region to the interpreter. And the region is parametered by BEGIN and END. But how to use these two, how to get a region? Thanks From skip at pobox.com Wed Nov 17 17:08:08 2004 From: skip at pobox.com (Skip Montanaro) Date: Wed Nov 17 17:07:26 2004 Subject: [Python-mode] a simple question In-Reply-To: References: Message-ID: <16795.30568.163108.299316@montanaro.dyndns.org> pipehappy> Hi! I an new in python and emacs. It says control-c | can pipehappy> send the region to the interpreter. And the region is pipehappy> parametered by BEGIN and END. But how to use these two, how pipehappy> to get a region? Use set-mark-command (usually bound to C-SPC) to set the mark. Move point (the cursor) to the other end of the region. Then hit C-c | to send the defined region to the interpreter. -- Skip Montanaro skip@mojam.com http://www.mojam.com/ From skip at pobox.com Sun Nov 21 05:49:20 2004 From: skip at pobox.com (Skip Montanaro) Date: Sun Nov 21 05:47:10 2004 Subject: [Python-mode] enhanced gdbinit file - looking for Python+Emacs+gdb users Message-ID: <16800.7760.739724.695902@montanaro.dyndns.org> I got a little carried away with the gdbinit file that lives in the Python distribution at Misc/gdbinit today. I decided there's no particular reason that gdb shouldn't display the current Python file when moving up and down the C stack any time it encounters PyEval_EvalFrame. After a little digging I realized this would be pretty easy. I made two changes to the gdbinit file: 1. I wrote a lineno command for gdb that calculates and prints the current Python line number. (It's PyCode_Addr2Line written in gdb's command language.) 2. Using that and the current file gleaned from PyEval_EvalFrame I emit the file:line info in the correct format for Emacs to display the Python line number at the right time using overridden up and down commands. There's one slight hitch. It works perfectly when travelling up the C stack using the up command, however in my environment at least (MacOSX w/ Apple's gcc and gdb) it causes gdb to segfault when travelling down the stack. I can't see anything that would make the behavior different going up instead of down. I need some people to try this thing out to see if it barfs for them as well. Maybe it's just something peculiar to my environment. OTOH, perhaps it's a bug in gdb. Since I can't really check this beast in given its current rather dicey behavior, I dropped a copy at http://www.musi-cal.com/~skip/python/gdbinit If you use Python with gdb via Emacs please give it a whirl and let me know how it works for you. Thanks, Skip P.S. I think I know how to make the gdb print command print Python objects as well... From martin at v.loewis.de Sun Nov 21 10:03:51 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun Nov 21 14:21:18 2004 Subject: [Python-mode] Re: [Python-Dev] enhanced gdbinit file - looking for Python+Emacs+gdb users In-Reply-To: <16800.7760.739724.695902@montanaro.dyndns.org> References: <16800.7760.739724.695902@montanaro.dyndns.org> Message-ID: <41A059F7.4080909@v.loewis.de> Skip Montanaro wrote: > There's one slight hitch. It works perfectly when travelling up the C stack > using the up command, however in my environment at least (MacOSX w/ Apple's > gcc and gdb) it causes gdb to segfault when travelling down the stack. I > can't see anything that would make the behavior different going up instead > of down. I need some people to try this thing out to see if it barfs for > them as well. Maybe it's just something peculiar to my environment. OTOH, > perhaps it's a bug in gdb. Without actually looking at your code: a segfault in gdb is always a bug, even if triggered through gdb macros. Regards, Martin