unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Matt McClure <matthewlmcclure@gmail.com>
Cc: 12340@debbugs.gnu.org
Subject: bug#12340: 24.2.50; python-shell-switch-to-shell in TRAMP buffer gives "No such file or directory: '/var/folders/vk/p95wm1qx0vdf0087p0z9qzc40000gn/T/py62333GTT'"
Date: Wed, 05 Sep 2012 17:03:10 +0200	[thread overview]
Message-ID: <878vcofr69.fsf@gmx.de> (raw)
In-Reply-To: <CAJELnLHESkg0pB_h0pR70JLzRcKVNHofOrO_dM_eaaigMT_U5w@mail.gmail.com>

Matt McClure <matthewlmcclure@gmail.com> writes:

> Actually, the first attempt didn't really work. Here's an updated
> patch: <https://github.com/matthewlmcclure/emacs/compare/master...debbug-12340>.
> I've tested this one on local and remote interpreters, using
> python-shell-send-{buffer,region,file}.

This are more than 15 changed lines, it doesn't count as tiny change. If
you want to get it pushed to Emacs, you would need to sign FSF legal
papers. Are you interested in?

I believe, the patch is too complicate. When you call
python-shell-send-file, you pass file-name in remote syntax, but
temp-file-name already stripped to the local file name part on the
remote side. This confuses, I believe. I wouldn't use
host-rel-temp-file-name here, and just pass temp-file-name as it is. All
the remote name strippings could be performed in python-shell-send-file.
Something like this (completely untested, but you get the idea):

--8<---------------cut here---------------start------------->8---
*** ~/src/emacs/lisp/progmodes/python.el.~109871~	2012-09-05 16:01:08.029147300 +0200
--- ~/src/emacs/lisp/progmodes/python.el	2012-09-05 16:35:03.756949973 +0200
***************
*** 1824,1830 ****
          (lines (split-string string "\n" t)))
      (and msg (message "Sent: %s..." (nth 0 lines)))
      (if (> (length lines) 1)
!         (let* ((temp-file-name (make-temp-file "py"))
                 (file-name (or (buffer-file-name) temp-file-name)))
            (with-temp-file temp-file-name
              (insert string)
--- 1824,1834 ----
          (lines (split-string string "\n" t)))
      (and msg (message "Sent: %s..." (nth 0 lines)))
      (if (> (length lines) 1)
!         (let* ((temporary-file-directory
!                 (if (file-remote-p default-directory)
!                     (concat (file-remote-p default-directory) "/tmp")
!                   temporary-file-directory))
!                (temp-file-name (make-temp-file "py"))
                 (file-name (or (buffer-file-name) temp-file-name)))
            (with-temp-file temp-file-name
              (insert string)
***************
*** 1940,1946 ****
        (concat "__pyfile = open('''%s''');"
                "exec(compile(__pyfile.read(), '''%s''', 'exec'));"
                "__pyfile.close()")
!       (or temp-file-name file-name) file-name)
       process)))

  (defun python-shell-switch-to-shell ()
--- 1944,1951 ----
        (concat "__pyfile = open('''%s''');"
                "exec(compile(__pyfile.read(), '''%s''', 'exec'));"
                "__pyfile.close()")
!       (or (file-remote-p temp-file-name 'localname) temp-file-name)
!       (or (file-remote-p file-name 'localname) file-name))
       process)))

  (defun python-shell-switch-to-shell ()
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





  reply	other threads:[~2012-09-05 15:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 16:34 bug#12340: 24.2.50; python-shell-switch-to-shell in TRAMP buffer gives "No such file or directory: '/var/folders/vk/p95wm1qx0vdf0087p0z9qzc40000gn/T/py62333GTT'" Matt McClure
2012-09-03 23:34 ` Matt McClure
2012-09-04  1:00   ` Matt McClure
2012-09-04 13:51   ` Michael Albinus
2012-09-04 20:23     ` Matt McClure
2012-09-05 15:03       ` Michael Albinus [this message]
2012-09-05 19:05         ` Matt McClure
2012-09-06  4:15           ` Chong Yidong
2012-09-07  2:12             ` Matt McClure
2012-09-07  2:52         ` Matt McClure
2012-09-07 11:45           ` Michael Albinus
2012-09-07 14:36             ` Matt McClure
2012-09-07 14:56               ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vcofr69.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=12340@debbugs.gnu.org \
    --cc=matthewlmcclure@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).