help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python-shell-send-region uses wrong encoding?


From: Ernest Adrogué
Subject: Re: python-shell-send-region uses wrong encoding?
Date: Thu, 31 Oct 2013 18:54:38 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

29-10-2013, 23:20 (-0400); Stefan Monnier escriu:
> I installed a variant of that patch in Emacs's trunk, which should fix
> the problem.

The original problem is fixed, but now there's another problem.  Send this
to Python:

class Foo(object):

      pass

and you get IndentationError.  The problem seems to be this change:

@@ -2034,26 +2038,32 @@ there for compatibility with CEDET.")
 (defun python-shell-send-string (string &optional process msg)
   "Send STRING to inferior Python PROCESS.
-When MSG is non-nil messages the first line of STRING."
+When MSG is non-nil messages the first line of STRING.
+If a temp file is used, return its name, otherwise return nil."
   (interactive "sPython command: ")
   (let ((process (or process (python-shell-get-or-create-process)))
-        (lines (split-string string "\n" t)))
-    (and msg (message "Sent: %s..." (nth 0 lines)))
-    (if (> (length lines) 1)
+        (_ (string-match "\\`\n*\\(.*\\)\\(\n.\\)?" string))
+        (multiline (match-beginning 2)))
+    (and msg (message "Sent: %s..." (match-string 1 string)))
+    (if multiline
         (let* ((temporary-file-directory





reply via email to

[Prev in Thread] Current Thread [Next in Thread]