emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bizarre gnuplot file creation error
@ 2017-11-04 17:05 Lawrence Bottorff
  2017-11-07 14:42 ` Lawrence Bottorff
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence Bottorff @ 2017-11-04 17:05 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]

Trying the babel gnuplot the other day, I had trouble getting the results
to C-c C-c to actually materialize in the place I'd given. Taking the
example from the org-mode babel gnuplot page, (changing the location):

#+begin_src gnuplot :exports both :file omnigraphics/omnig10.png
reset

set title "Putting it All Together"

set xlabel "X"
set xrange [-15:15]
set xtics -15,2,15


set ylabel "Y"
set yrange [-15:15]
set ytics -15,2,15

f(x) = sqrt(x - 1) + 1
g(x) = x**3
h(x) = sqrt(-x - 1) + 1

plot f(x) w lp lw 1, g(x) w lp lw 1, h(x) w l lw 1
#+end_src

The system was not creating the png in the given folder. Finally it
occurred to me to look in another place where I'd previously been creating
org-mode gnuplot pngs -- and there it was! I could do C-c C-c again and
again and see new versions of the png being created each time in
yesterday's folder, i.e., not the location given with :file. So the
:file omnigraphics/omnig10.png was being blown off and org-mode internal
had remembered where I'd previously created pngs and kept creating them
there. I've tried to recreate this scenario with just the code snippet
above -- fresh (non-daemon) emacs processes, changing the :file location
each time -- and I've reproduced the problem sometimes. I've combed through
my personal init els and it's definitely nothing I'm telling it. Strange. .
. .

LB

[-- Attachment #2: Type: text/html, Size: 1741 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-04 17:05 Bizarre gnuplot file creation error Lawrence Bottorff
@ 2017-11-07 14:42 ` Lawrence Bottorff
  2017-11-09 18:07   ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence Bottorff @ 2017-11-07 14:42 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]

Still haven't tracked down the exact steps to reproduce this problem, but
it happened again recently -- and starting a new emacs from the command
line solved it, i.e., my usual daemon-run emacs seems to be "crudding up"
somehow.

On Sat, Nov 4, 2017 at 1:05 PM, Lawrence Bottorff <borgauf@gmail.com> wrote:

> Trying the babel gnuplot the other day, I had trouble getting the results
> to C-c C-c to actually materialize in the place I'd given. Taking the
> example from the org-mode babel gnuplot page, (changing the location):
>
> #+begin_src gnuplot :exports both :file omnigraphics/omnig10.png
> reset
>
> set title "Putting it All Together"
>
> set xlabel "X"
> set xrange [-15:15]
> set xtics -15,2,15
>
>
> set ylabel "Y"
> set yrange [-15:15]
> set ytics -15,2,15
>
> f(x) = sqrt(x - 1) + 1
> g(x) = x**3
> h(x) = sqrt(-x - 1) + 1
>
> plot f(x) w lp lw 1, g(x) w lp lw 1, h(x) w l lw 1
> #+end_src
>
> The system was not creating the png in the given folder. Finally it
> occurred to me to look in another place where I'd previously been creating
> org-mode gnuplot pngs -- and there it was! I could do C-c C-c again and
> again and see new versions of the png being created each time in
> yesterday's folder, i.e., not the location given with :file. So the
> :file omnigraphics/omnig10.png was being blown off and org-mode internal
> had remembered where I'd previously created pngs and kept creating them
> there. I've tried to recreate this scenario with just the code snippet
> above -- fresh (non-daemon) emacs processes, changing the :file location
> each time -- and I've reproduced the problem sometimes. I've combed through
> my personal init els and it's definitely nothing I'm telling it. Strange. .
> . .
>
> LB
>

[-- Attachment #2: Type: text/html, Size: 2412 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-07 14:42 ` Lawrence Bottorff
@ 2017-11-09 18:07   ` Eric S Fraga
  2017-11-16 21:40     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2017-11-09 18:07 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

On Tuesday,  7 Nov 2017 at 09:42, Lawrence Bottorff wrote:
> Still haven't tracked down the exact steps to reproduce this problem, but
> it happened again recently -- and starting a new emacs from the command
> line solved it, i.e., my usual daemon-run emacs seems to be "crudding up"
> somehow.

The issue is that gnuplot mode uses a gnuplot session (in the *gnuplot*
buffer).  If you start gnuplot by executing a src block somewhere in
your file system and then move to another org file elsewhere in the file
system, the same *gnuplot* buffer will be used, placing the file in the
wrong place as far as the second file is concerned.  The working
directory of the gnuplot buffer is not updated.

The immediate solution is to kill the *gnuplot* buffer...  messy but works.

The proper solution would be to update ob-gnuplot to change the working
directory at every invocation of gnuplot to be the directory where the
org file is found.  (gnuplot has a "cd" command for this purpose)

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.2-117-g5b2b8f

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-09 18:07   ` Eric S Fraga
@ 2017-11-16 21:40     ` Nicolas Goaziou
  2017-11-17  7:45       ` Eric S Fraga
  2017-11-22 14:03       ` Eric S Fraga
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2017-11-16 21:40 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

Hello,

Eric S Fraga <esflists@gmail.com> writes:

> The proper solution would be to update ob-gnuplot to change the working
> directory at every invocation of gnuplot to be the directory where the
> org file is found.  (gnuplot has a "cd" command for this purpose)

Would you like to propose a patch for that? BTW should the new working
directory be Org file's or :file, or even :dir?

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-16 21:40     ` Nicolas Goaziou
@ 2017-11-17  7:45       ` Eric S Fraga
  2017-11-22 14:03       ` Eric S Fraga
  1 sibling, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2017-11-17  7:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode Mailinglist, Lawrence Bottorff

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

On Thursday, 16 Nov 2017 at 22:40, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <esflists@gmail.com> writes:
>
>> The proper solution would be to update ob-gnuplot to change the working
>> directory at every invocation of gnuplot to be the directory where the
>> org file is found.  (gnuplot has a "cd" command for this purpose)
>
> Would you like to propose a patch for that? BTW should the new working
> directory be Org file's or :file, or even :dir?

I can try... but I really probably don't have a clue how to find the
directory for any of the alternatives you mention.  My gut feeling is
that it should be the org file's directory but I guess :dir should
override this.

Anyway, I'll play with it and get back to you.

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-162-gde289d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-16 21:40     ` Nicolas Goaziou
  2017-11-17  7:45       ` Eric S Fraga
@ 2017-11-22 14:03       ` Eric S Fraga
  2017-11-28 23:21         ` Nicolas Goaziou
  1 sibling, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2017-11-22 14:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode Mailinglist, Lawrence Bottorff

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On Thursday, 16 Nov 2017 at 22:40, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <esflists@gmail.com> writes:
>
>> The proper solution would be to update ob-gnuplot to change the working
>> directory at every invocation of gnuplot to be the directory where the
>> org file is found.  (gnuplot has a "cd" command for this purpose)
>
> Would you like to propose a patch for that? BTW should the new working
> directory be Org file's or :file, or even :dir?

Nicolas,

can you please advise on how to get the directory the originating org
file may lie in from within org-babel-expand-body:gnuplot?

I cannot remember if I answered your second question but my gut feeling
is that the change of directory should be automatic; the file directive
can always specify a full path if desired.

Thanks,
eric

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-162-gde289d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bizarre gnuplot file creation error
  2017-11-22 14:03       ` Eric S Fraga
@ 2017-11-28 23:21         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2017-11-28 23:21 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

Hello,

Eric S Fraga <esflists@gmail.com> writes:

> On Thursday, 16 Nov 2017 at 22:40, Nicolas Goaziou wrote:
>> Hello,
>>
>> Eric S Fraga <esflists@gmail.com> writes:
>>
>>> The proper solution would be to update ob-gnuplot to change the working
>>> directory at every invocation of gnuplot to be the directory where the
>>> org file is found.  (gnuplot has a "cd" command for this purpose)
>>
>> Would you like to propose a patch for that? BTW should the new working
>> directory be Org file's or :file, or even :dir?
>
> Nicolas,
>
> can you please advise on how to get the directory the originating org
> file may lie in from within org-babel-expand-body:gnuplot?

No idea. 

  (and (buffer-file-name) (file-name-directory (buffer-file-name)))

?

The originating Org file may not exist.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-28 23:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-04 17:05 Bizarre gnuplot file creation error Lawrence Bottorff
2017-11-07 14:42 ` Lawrence Bottorff
2017-11-09 18:07   ` Eric S Fraga
2017-11-16 21:40     ` Nicolas Goaziou
2017-11-17  7:45       ` Eric S Fraga
2017-11-22 14:03       ` Eric S Fraga
2017-11-28 23:21         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).