From noreply at sourceforge.net Sat Mar 11 07:07:22 2006 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 10 Mar 2006 22:07:22 -0800 Subject: [Python-mode] [ python-mode-Patches-1023335 ] Handle triple-quoted strings correctly. Message-ID: Patches item #1023335, was opened at 2004-09-06 18:22 Message generated for change (Comment added) made by edloper You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581351&aid=1023335&group_id=86916 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Edward Loper (edloper) Assigned to: Edward Loper (edloper) 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: Edward Loper (edloper) Date: 2006-03-11 01:07 Message: Logged In: YES user_id=195958 I have attached a new version of the patch, which should hopefully address both Skip's issue, and the problem that Johannes Gijsbers pointed out. I'd appreciate it if several people could try it out (preferably on both emacs and xemacs), and let me know if it works. danielx_: download the patch file (handle-tqs-v2.diff) at the bottom of this page, and run "patch python-mode.el handle-tqs-v2.diff". The changes I made were: - removed (require 'text-properties), since 'text- properties isn't defined as a feature in emacs; and it should be available by default in both xemacs and emacs, anyway. - Replaced calls to "replace-regexp-in-string" with a compatibility function "py-replace-regexp-in-string", since the former is only available on xemacs. - Fixed a bug in the regexp used to find the end of comments (this was what caused problems in BaseHTTPServer.py). ---------------------------------------------------------------------- Comment By: Daniel (danielx_) Date: 2005-11-19 18:43 Message: Logged In: YES user_id=1383230 Sorry, how do I install this? I'm using python-mode ver1.0alpha, found on the "Files" page. ---------------------------------------------------------------------- Comment By: Skip Montanaro (montanaro) Date: 2005-06-04 16:46 Message: Logged In: YES user_id=44345 Ed, this looks like this would be a good addition, but there are some problems. Is there any resolution to Johannes' note about comment breakage? I just patched my copy of python-mode.el. When I visit a .py file it complains that it can't find the text-properties package. (This is XEmacs 21.4.15.) I didn't see anything like text-properties or properties in the package list. ---------------------------------------------------------------------- Comment By: Johannes Gijsbers (jlgijsbers) Date: 2004-11-01 11: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-06 22:15 Message: Logged In: YES user_id=195958 So I did. Trying again. ---------------------------------------------------------------------- Comment By: Skip Montanaro (montanaro) Date: 2004-09-06 21: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 noreply at sourceforge.net Sun Mar 12 06:56:18 2006 From: noreply at sourceforge.net (SourceForge.net) Date: Sat, 11 Mar 2006 21:56:18 -0800 Subject: [Python-mode] [ python-mode-Bugs-1448154 ] Setting py-python-command after M-x py-shell doesn't work Message-ID: Bugs item #1448154, was opened at 2006-03-12 16:56 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nicholas Sandow (njsand) Assigned to: Nobody/Anonymous (nobody) Summary: Setting py-python-command after M-x py-shell doesn't work Initial Comment: If I do M-x py-shell, I get an error: "Searching for program: no such file or directory, python" That's ok, I just need to set `py-python-command', right? (setq py-python-command "c:/python24/python.exe") Then I do M-x py-shell again, I get the same error message: "Searching for program: no such file or directory, python" Why didn't setting py-python-command work? However, if I switch to another buffer, (actually a buffer in which I haven't tried M-x py-shell before setting `py-python-command') M-x py-shell will now work. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 From noreply at sourceforge.net Sun Mar 12 20:35:50 2006 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 12 Mar 2006 11:35:50 -0800 Subject: [Python-mode] [ python-mode-Bugs-1448154 ] Setting py-python-command after M-x py-shell doesn't work Message-ID: Bugs item #1448154, was opened at 2006-03-12 00:56 Message generated for change (Comment added) made by edloper You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nicholas Sandow (njsand) Assigned to: Nobody/Anonymous (nobody) Summary: Setting py-python-command after M-x py-shell doesn't work Initial Comment: If I do M-x py-shell, I get an error: "Searching for program: no such file or directory, python" That's ok, I just need to set `py-python-command', right? (setq py-python-command "c:/python24/python.exe") Then I do M-x py-shell again, I get the same error message: "Searching for program: no such file or directory, python" Why didn't setting py-python-command work? However, if I switch to another buffer, (actually a buffer in which I haven't tried M-x py-shell before setting `py-python-command') M-x py-shell will now work. ---------------------------------------------------------------------- >Comment By: Edward Loper (edloper) Date: 2006-03-12 14:35 Message: Logged In: YES user_id=195958 There's a buffer-local variable "py-which-shell," which is used to record what shell command you're using (and also "py-which-args"); this gets initialized the first time you run py-shell. It appears that the reasoning behind this has to do with toggling between cpython and jython, but it's not entirely clear to me from looking at the code. One way to make things a little more user friendly would be to add an initializer function to the defcustom that defines py-python-command, that calls "(py-toggle- shells 'cpython)"; but in your case, that wouldn't have helped, since you directly modified py-python-command using setq, rather than customize-variable. If you just want to get things working in that one buffer, the following should work: (setq py-python-command "c:/python24/python.exe") (py-toggle-shells 'cpython) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 From noreply at sourceforge.net Sun Mar 12 20:47:28 2006 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 12 Mar 2006 11:47:28 -0800 Subject: [Python-mode] [ python-mode-Bugs-1448154 ] Setting py-python-command after M-x py-shell doesn't work Message-ID: Bugs item #1448154, was opened at 2006-03-12 00:56 Message generated for change (Comment added) made by edloper You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nicholas Sandow (njsand) Assigned to: Nobody/Anonymous (nobody) Summary: Setting py-python-command after M-x py-shell doesn't work Initial Comment: If I do M-x py-shell, I get an error: "Searching for program: no such file or directory, python" That's ok, I just need to set `py-python-command', right? (setq py-python-command "c:/python24/python.exe") Then I do M-x py-shell again, I get the same error message: "Searching for program: no such file or directory, python" Why didn't setting py-python-command work? However, if I switch to another buffer, (actually a buffer in which I haven't tried M-x py-shell before setting `py-python-command') M-x py-shell will now work. ---------------------------------------------------------------------- >Comment By: Edward Loper (edloper) Date: 2006-03-12 14:47 Message: Logged In: YES user_id=195958 There's a buffer-local variable "py-which-shell," which is used to record what shell command you're using (and also "py-which-args"); this gets initialized the first time you run py-shell. It appears that the reasoning behind this has to do with toggling between cpython and jython, but it's not entirely clear to me from looking at the code. One way to make things a little more user friendly would be to add an initializer function to the defcustom that defines py-python-command, that calls "(py-toggle- shells 'cpython)"; but in your case, that wouldn't have helped, since you directly modified py-python-command using setq, rather than customize-variable. If you just want to get things working in that one buffer, the following should work: (setq py-python-command "c:/python24/python.exe") (py-toggle-shells 'cpython) ---------------------------------------------------------------------- Comment By: Edward Loper (edloper) Date: 2006-03-12 14:35 Message: Logged In: YES user_id=195958 There's a buffer-local variable "py-which-shell," which is used to record what shell command you're using (and also "py-which-args"); this gets initialized the first time you run py-shell. It appears that the reasoning behind this has to do with toggling between cpython and jython, but it's not entirely clear to me from looking at the code. One way to make things a little more user friendly would be to add an initializer function to the defcustom that defines py-python-command, that calls "(py-toggle- shells 'cpython)"; but in your case, that wouldn't have helped, since you directly modified py-python-command using setq, rather than customize-variable. If you just want to get things working in that one buffer, the following should work: (setq py-python-command "c:/python24/python.exe") (py-toggle-shells 'cpython) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1448154&group_id=86916 From noreply at sourceforge.net Sun Mar 12 20:50:36 2006 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 12 Mar 2006 11:50:36 -0800 Subject: [Python-mode] [ python-mode-Bugs-1021885 ] shell gets set to 'cpython' Message-ID: Bugs item #1021885, was opened at 2004-09-03 11:24 Message generated for change (Comment added) made by edloper You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1021885&group_id=86916 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Fixed Priority: 5 Submitted By: Dan Christensen (jdc) Assigned to: Nobody/Anonymous (nobody) Summary: shell gets set to 'cpython' Initial Comment: If I edit a source file which starts with #!/usr/bin/python and I hit C-c C-c to run it, then py-execute-region sets the variable shell using (setq shell (or (py-choose-shell-by-shebang) (py-choose-shell-by-import) py-which-shell)))) The function py-choose-shell-by-shebang returns cpython. Then a bit further down we have (let ((cmd (concat shell ... which gives an error: Debugger entered--Lisp error: (wrong-type-argument sequencep cpython) concat(cpython "") The only related line in my .emacs.el is (require 'python-mode) Dan ---------------------------------------------------------------------- >Comment By: Edward Loper (edloper) Date: 2006-03-12 14:50 Message: Logged In: YES user_id=195958 It appears to me that this was fixed in cvs revision 4.66, which changed "(let ((cmd (concat shell..." to "(let ((cmd (concat py-which-shell". I'm closing this bug as fixed for now, but if it's still not working for you using the current cvs version, let me know and I'll take another look at it. ---------------------------------------------------------------------- Comment By: Martin Blais (blais) Date: 2005-01-06 15:20 Message: Logged In: YES user_id=10996 I also report the same problem. Same place, same reason. shell gets set to a symbol, and it's attempted to be concat'ed. This break py-execute-buffer, and IMO it's a major showstopper. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=581349&aid=1021885&group_id=86916