From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: Re: results from Python block not visible Date: Wed, 2 Jul 2014 23:51:05 +0700 Message-ID: References: <87r42bhcil.wl%n142857@gmail.com> <87vbrntyow.fsf@gmail.com> <87pphvh9l4.wl%n142857@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1133f738c0b7b504fd38b211 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2NkW-0002fs-Fx for emacs-orgmode@gnu.org; Wed, 02 Jul 2014 12:51:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2NkQ-0007rg-U2 for emacs-orgmode@gnu.org; Wed, 02 Jul 2014 12:51:12 -0400 Received: from mail-ve0-x22b.google.com ([2607:f8b0:400c:c01::22b]:49676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2NkQ-0007rA-Nx for emacs-orgmode@gnu.org; Wed, 02 Jul 2014 12:51:06 -0400 Received: by mail-ve0-f171.google.com with SMTP id jz11so11441684veb.16 for ; Wed, 02 Jul 2014 09:51:05 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: org-mode Mailinglist --001a1133f738c0b7b504fd38b211 Content-Type: text/plain; charset=ISO-8859-1 Since this org-babel + tramp-cache incompatibility is very puzzling, I continued researching it. The line that makes my Python block stop working (i.e. outputting None instead of the "x" I asked with print "x') is this one, found in tramp-cache.el: (add-hook 'kill-buffer-hook 'tramp-flush-file-function) Its code is: (defun tramp-flush-file-function () "Flush all Tramp cache properties from `buffer-file-name'. This is suppressed for temporary buffers." (unless (string-match "^ \\*temp\\*" (or (buffer-name) "")) (let ((bfn (if (stringp (buffer-file-name)) (buffer-file-name) default-directory))) (when (tramp-tramp-file-p bfn) (with-parsed-tramp-file-name bfn nil (tramp-flush-file-property v localname)))))) That "temporary buffer detector" is working correctly because org-babel buffers have names like " *temp*-993012", which are correctly detected. I'm afraid that the (string-match ...) will forget the last search, so later (match-string) done by babel will be from the wrong search. Can this happen? -- Daniel On Fri, Jun 27, 2014 at 4:50 PM, Daniel Clemente wrote: > I confirm that with Debian's Emacs, org-babel works well after the > (require 'tramp-cache): > GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-06 > on barber, modified by Debian > > But it fails with my compiled one from 2014-06-20. > > So is it because of tramp-cache or org-babel? > > > On Fri, Jun 27, 2014 at 12:19 AM, Daniel Clemente > wrote: > >> >> El Thu, 26 Jun 2014 12:36:47 -0400 Eric Schulte va escriure: >> > > #+BEGIN_SRC python :results output >> > > print "x" >> > > #+END_SRC >> > > >> > > It prints: >> > > >> > > #+RESULTS: >> > > : None >> > > >> > > I expected to see "x". This worked some days ago. >> > > >> > >> > This works for me using the latest version of Org-mode with an Emacs >> > launched by running "make vanilla" from the base of the Org-mode repo. >> > >> I didn't know "make vanilla". It worked fine from there, I don't know >> why from "emacs -Q" it didn't. >> >> > Maybe the problem is in your configuration? >> >> Exactly, it is from my configuration, because after loading my full >> configuration, I see the problem again and code highlighting suddenly >> disappears. >> >> I identified the exact lines that cause org-babel to stop failing. >> Bewonder: >> >> (autoload 'tramp "tramp" "Remotely access files." t) >> (require 'tramp-cache) >> >> Yes! After C-x C-e on the first line, org-babel still works. After C-x >> C-e on the second line, it doesn't work anymore. >> There were some Tramp changes in latest Emacs, maybe they are bad. I'm >> using: GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw >> scroll bars) of 2014-06-20 on la4 >> >> >> What a strange bug... >> >> > --001a1133f738c0b7b504fd38b211 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Since this org-babel + tramp-cache incompat= ibility is very puzzling, I continued researching it. The line that makes m= y Python block stop working (i.e. outputting None instead of the "x&qu= ot; I asked with print "x') is this one, found in tramp-cache.el:<= br>
(add-hook 'kill-buffer-hook 'tramp-flush-file-function)

=
Its code is:

(defun tramp-flush-file-function ()
 &qu= ot;Flush all Tramp cache properties from `buffer-file-name'.
This is= suppressed for temporary buffers."
 (unless (string-match "^ \\*temp\\*" (or (buffer-name) &qu= ot;"))
   (let ((bfn (if (stringp (buffer-file-name))   (buffer-file-name)
default-directory)))
    =  (when (tramp-tramp-file-p bfn)
(with-parsed-tramp-file-name bfn nil
 (tramp-flush-file-property= v localname))))))


That „temporary buffer detector&l= dquo; is working correctly because org-babel buffers have names like "= *temp*-993012", which are correctly detected.
I'm afraid that the (string-match …) will forget the last search= , so later (match-string) done by babel will be from the wrong search. Can = this happen?

--
Daniel


On Fri, Jun 27, 2014 at 4:50 PM, Daniel = Clemente <n142857@gmail.com> wrote:
I confirm that with Debian's Emacs, org-babe= l works well after the (require 'tramp-cache):
GNU Emacs 24.3.1 (x86= _64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-06 on barber, modified by= Debian

But it fails with my compiled one from 2014-06-20.

S= o is it because of tramp-cache or org-babel?


On Fri, Jun 27, 2014 at 12:19 AM, Daniel Clemente <n142857@gmail.com&g= t; wrote:

El Thu, 26 Jun 2014 12:36:47 -0400 Eric Schulte va escriure:
> > #+BEGIN_SRC python :results output
> > print "x"
> > #+END_SRC
> >
> > It prints:
> >
> > #+RESULTS:
> > : None
> >
> > I expected to see "x". This worked some days ago.
> >
>
> This works for me using the latest version of Org-mode with an Emacs > launched by running "make vanilla" from the base of the Org-= mode repo.
>
  I didn't know "make vanilla". It worked fine fro= m there, I don't know why from „emacs -Q“ it didn't.

> Maybe the problem is in your configuration?

  Exactly, it is from my configuration, because after loading my= full configuration, I see the problem again and code highlighting suddenly= disappears.

  I identified the exact lines that cause org-babel to stop failing. B= ewonder:

  (autoload 'tramp "tramp" "Remotely access files.&= quot; t)
  (require 'tramp-cache)

  Yes! After C-x C-e on the first line, org-babel still works. After C= -x C-e on the second line, it doesn't work anymore.
  There were some Tramp changes in latest Emacs, maybe they are bad. I= 'm using:  GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, X toolki= t, Xaw scroll bars) of 2014-06-20 on la4


  What a strange bug…



--001a1133f738c0b7b504fd38b211--