emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]
@ 2023-02-07 17:41 Thomas Worthington
  2023-02-08 13:33 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Worthington @ 2023-02-07 17:41 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don’t know how to make a good report? See

https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.

________________________________

Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2022-01-24, modified by Debian Package: Org mode version 9.6.1 ( @ home/thomas.emacs.d/elpa/org-9.6.1/)

current state: ============ (setq org-duration-format ’h:mm org-src-mode-hook ’(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook ’(org-clock-out-if-current) org-ctrl-c-ctrl-c-final-hook ’(org-msg-ctrl-c-ctrl-c) org-link-shell-confirm-function ’yes-or-no-p org-blank-before-new-entry ’((heading) (plain-list-item)) org-babel-after-execute-hook ’(org-display-inline-images) org-metadown-hook ’(org-babel-pop-to-session-maybe) org-export-with-sub-superscripts nil org-refile-targets ’((org-agenda-files :maxlevel . 4)) org-html-format-inlinetask-function ’org-html-format-inlinetask-default-function org-enforce-todo-dependencies t org-odt-format-headline-function ’org-odt-format-headline-default-function org-persist-before-write-hook ’(org-element–cache-persist-before-write) org-agenda-files ’(“home/thomas/orgfiles/worktime.org“ ”/home/thomas/orgfiles/meetings.org“ ”/home/thomas/orgfiles/todo.org“ ”/home/thomas/orgfiles/reminders.org“) org-ascii-format-inlinetask-function ‘org-ascii-format-inlinetask-default org-odt-fontify-srcblocks nil org-plantuml-jar-path ”/usr/share/plantuml/plantuml.jar“ org-blocker-hook ’(org-block-todo-from-children-or-siblings-or-parent org-block-todo-from-checkboxes) org-archive-location ”%s.archive::“ org-odt-preferred-output-format ”pdf“ org-mode-hook ’(#[0 ”\301\211.\207“ [imenu-create-index-function org-imenu-get-tree] 2] my-org-mode-config org-tempo-setup ws-butler-mode turn-on-visual-line-mode er/add-org-mode-expansions #[0 ”\300\301\302\303\304$\207“ [add-hook change-major-mode-hook org-show-block-all append local] 5 ”\n\n(fn)“] #[0 ”\300\301\302\303\304$\207“ [add-hook change-major-mode-hook org-babel-show-result-all append local] 5 ”\n\n(fn)“] org-babel-result-hide-spec org-babel-hide-all-hashes) org-export-with-smart-quotes t org-odt-format-drawer-function #[514 ”\207“ [] 3 ”\n\n(fn NAME CONTENTS)“] org-archive-hook ’(org-attach-archive-delete-maybe) org-persist-before-read-hook ’(org-element–cache-persist-before-read) org-confirm-elisp-link-function ‘yes-or-no-p org-agenda-before-write-hook ’(org-agenda-add-entry-text) org-metaup-hook ’(org-babel-load-in-session-maybe) org-persist-after-read-hook ’(org-element–cache-persist-after-read) org-bibtex-headline-format-function #[257 ”\300.\236A\207“ [:title] 3 ”\n\n(fn ENTRY)“] org-latex-format-drawer-function #[514 ”\207“ [] 3 ”\n\n(fn _ CONTENTS)“] org-babel-pre-tangle-hook ’(save-buffer) org-tab-first-hook ’(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages ’((ditaa \.t) (dot . t) (forth \.t) (java . t) (js . t) (gnuplot . t) (octave . t) (perl . t) (php \.t) (plantuml . t) (R . t) (ruby . t) (sed . t) (shell . t) (sql . t) (sqlite . t)) org-log-done ‘time org-link-abbrev-alist ’((”piv“ . ”%(make-piv-link)“)) org-ascii-format-drawer-function #[771 ”.\207“ [] 4 ”\n\n(fn NAME CONTENTS WIDTH)“] org-msg-mode t org-cycle-tab-first-hook ’(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-agenda-span ‘fortnight org-agenda-loop-over-headlines-in-active-region nil org-src-lang-modes ’((”php“ . php) (”ocaml“ . tuareg) (”elisp“ . emacs-lisp) (”ditaa“ . artist) (”asymptote“ . asy) (”dot“ . graphviz-dot) (”sqlite“ . sql) (”calc“ . fundamental) (”C“ . c) (”cpp“ . c++) (”C++“ . c++) (”screen“ . shell-script) (”shell“ . sh) (”bash“ . sh)) org-msg-greeting-fmt ”\nHi %s,\n\n“ org-agenda-prefix-format ’((agenda . ” %i %-12:c%?-12t% s %b“) (timeline . ” % s“) (todo . ” %i %-12:c %b“) (tags . ” %i %-12:c“) (search . ” %i %-12:c“)) org-fold-core-isearch-open-function ‘org-fold-core–isearch-reveal org-occur-hook ’(org-first-headline-recenter) org-cycle-separator-lines 1 org-enforce-todo-checkbox-dependencies t org-agenda-include-diary t org-structure-template-alist ’((”n“ . ”notes“) (”a“ . ”export ascii“) (”c“ . ”center“) (”C“ . ”comment“) (”e“ . ”example“) (”E“ . ”export“) (”h“ . ”export html“) (”l“ . ”export latex“) (”q“ . ”quote“) (”s“ . ”src“) (”v“ . ”verse“)) org-cycle-hook ’(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images) org-todo-keywords ’((sequence ”TODO(t)“ ”STARTED“ ”|“ ”DONE(-!)“ ”|“ ”CANCELLED(x@)“)) org-speed-command-hook ’(org-speed-command-activate org-babel-speed-command-activate) org-msg-startup ”hidestars indent inlineimages“ org-odt-format-inlinetask-function ‘org-odt-format-inlinetask-default-function org-babel-tangle-lang-exts ’((”sed“ . ”sed“) (”ruby“ . ”rb“) (”perl“ . ”pl“) (”java“ . ”java“) (”emacs-lisp“ . ”el“) (”elisp“ . ”el“)) org-refile-use-outline-path ‘file org-clock-display-default-range ‘untilnow org-export-before-parsing-hook ’(org-attach-expand-links) org-confirm-shell-link-function ‘yes-or-no-p org-stuck-projects ’(”+LEVEL=2-DONE” (“TODO” “STARTED” “PASSED”) nil “”) org-link-parameters ’((“attachment” :follow org-attach-follow :complete org-attach-complete-link) (“eww” :follow org-eww-open :store org-eww-store-link) (“rmail” :follow org-rmail-open :store org-rmail-store-link) (“mhe” :follow org-mhe-open :store org-mhe-store-link) (“irc” :follow org-irc-visit :store org-irc-store-link :export org-irc-export) (“info” :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) (“gnus” :follow org-gnus-open :store org-gnus-store-link) (“docview” :follow org-docview-open :export org-docview-export :store org-docview-store-link) (“bibtex” :follow org-bibtex-open :store org-bibtex-store-link) (“bbdb” :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) (“w3m” :store org-w3m-store-link) (“doi” :follow org-link-doi-open :export org-link-doi-export) (“mu4e” :follow mu4e-org-open :store mu4e-org-store-link) (“id” :follow org-id-open) (“elfeed” :follow elfeed-link-open :store elfeed-link-store-link) (“file+sys”) (“file+emacs”) (“shell” :follow org-link–open-shell) (“news” :follow #[514 “\301\300\302.Q.\”\207“ [”news“ browse-url ”:“] 6 ”\n\n(fn URL ARG)“]) (”mailto“ :follow #[514 ”\301\300\302.Q.\“\207” [“mailto” browse-url “:”] 6 “\n\n(fn URL ARG)”]) (“https” :follow #[514 “\301\300\302.Q.\”\207“ [”https“ browse-url ”:“] 6 ”\n\n(fn URL ARG)“]) (”http“ :follow #[514 ”\301\300\302.Q.\“\207” [“http” browse-url “:”] 6 “\n\n(fn URL ARG)”]) (“ftp” :follow #[514 “\301\300\302.Q.\”\207“ [”ftp“ browse-url ”:“] 6 ”\n\n(fn URL ARG)“]) (”help“ :follow org-link–open-help :store org-link–store-help) (”file“ :complete org-link-complete-file) (”elisp“ :follow org-link–open-elisp)) org-msg-greeting-fmt-mailto t org-latex-format-headline-function ‘org-latex-format-headline-default-function org-capture-templates ’((”t“ ”Todo (within the week)“ entry (file+headline ”~/orgfiles/todo.org“ ”Pickup Tasks“) ”* TODO %?\nSCHEDULED: %(org-insert-time-stamp (current-time))\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \“+7d\”))\n %a“) (”p“ ”Pickup (Starts now)“ entry (file+headline ”~/orgfiles/worktime.org“ ”Pickup Tasks“) ”* STARTED %?\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \“+7d\”))\n %a“ :jump-to-captured t :clock-in t :clock-keep t) (”r“ ”Reminder (1 week/1 month)“ entry (file ”~/orgfiles/reminders.org“) ”* TODO %?\n SCHEDULED: %(org-insert-time-stamp (org-read-date nil t \“+7d\”))\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \“+30d\”))“ :empty-lines-before 1 :empty-lines-after 1) (”T“ ”Ticket“ entry (file+headline ”~/orgfiles/worktime.org“ ”New Tickets“) ”* TODO %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t))\n %a“ :jump-to-captured t :empty-lines-before 1 :empty-lines-after 1 :clock-in t :clock-keep t) (”m“ ”Meeting start now“ entry (file+headline ”~/orgfiles/meetings.org“ ”Meetings“) ”* STARTED %?“ :jump-to-captured t :empty-lines 1 :clock-in t :clock-keep t) (”M“ ”Meeting start later“ entry (file+headline ”~/orgfiles/meetings.org“ ”Meetings“) ”* TODO %?\n SCHEDULED: %(org-insert-time-stamp (current-time))“ :jump-to-captured t :empty-lines 1)) org-link-elisp-confirm-function ‘yes-or-no-p org-todo-keyword-faces ’((”CLIENT“ . ”yellow“) (”BLOCKED“ . ”red“) (”QUOTED“ . ”WHITE“) (”DONE“ . ”green“) (”PASSED“ . ”deep sky blue“) (”CANCELLED“ . ”dark orange“) (”TO-QUOTE“ . ”dark yellow“)) org-latex-format-inlinetask-function ‘org-latex-format-inlinetask-default-function org-tab-before-tab-emulation-hook ’(org-tempo-complete-tag) org-html-format-drawer-function #[514 ”\207“ [] 3 ”\n\n(fn NAME CONTENTS)“] org-export-with-toc nil org-clock-in-switch-to-state ‘tw/switch-task-on-clock-start org-html-format-headline-function ‘org-html-format-headline-default-function org-msg-options ”html-postamble:nil H:5 num:nil ^:{} toc:nil“ org-agenda-start-on-weekday nil org-list-allow-alphabetical t )

Hi,

org-babel-gnuplot-process-vars in ob-gnuplot.el makes a temporary file to store a table imported from the current org file using :var

However, the name of this file does not include the name of the variable or any similar field unique to the data. This means that if you want to plot data from two tables, they both get the same filename and consequently the second overwrites the first and the data is incorrect.

I switched line 103 from:

(org-babel-temp-stable-file (cons val params) "gnuplot-")


to:

(org-babel-temp-stable-file (cons val params) (concat "gnuplot-" (prin1-to-string (car pair)) "-"))


which includes the variable name into the generated filename and this appears to work for me.

Thomas Worthington

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

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

* Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]
  2023-02-07 17:41 [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)] Thomas Worthington
@ 2023-02-08 13:33 ` Ihor Radchenko
  2023-02-08 21:13   ` Thomas Worthington
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-02-08 13:33 UTC (permalink / raw)
  To: Thomas Worthington; +Cc: emacs-orgmode@gnu.org

Thomas Worthington <thomas.worthington@cosector.com> writes:

> org-babel-gnuplot-process-vars in ob-gnuplot.el makes a temporary file to store a table imported from the current org file using :var
>
> However, the name of this file does not include the name of the variable or any similar field unique to the data. This means that if you want to plot data from two tables, they both get the same filename and consequently the second overwrites the first and the data is incorrect.

May you provide an example of such problem?

I just tried

#+name: table1
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
#+name: table2
| 1 | -1 |
| 2 | -2 |
| 3 | -3 |
| 4 | -4 |
| 5 | -5 |

#+begin_src gnuplot :var x=table1 y=table2 :cache no
plot x, y w l
#+end_src

And both the tables are correctly plotted.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]
  2023-02-08 13:33 ` Ihor Radchenko
@ 2023-02-08 21:13   ` Thomas Worthington
  2023-02-09 10:58     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Worthington @ 2023-02-08 21:13 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org

Well, bloody hell.

I can't replicate now. It was about four weeks ago I tripped over 
this and I absolutely saw it in action repeatedly - I could see 
gnuplot loading the same file in its process buffer, and only one 
file being created on-disc too.

Maybe I updated org since then, but I didn't think so.

Sorry to have wasted your time. If it comes back I'll let you 
know.

Computers! Who'd have 'em?

Thomas


On Wed, Feb 08 2023, Ihor Radchenko wrote:

> Thomas Worthington <thomas.worthington@cosector.com> writes:
>
>> org-babel-gnuplot-process-vars in ob-gnuplot.el makes a 
>> temporary file to store a table imported from the current org 
>> file using :var
>>
>> However, the name of this file does not include the name of the
>> variable or any similar field unique to the data. This means 
>> that if
>> you want to plot data from two tables, they both get the same
>> filename and consequently the second overwrites the first and 
>> the
>> data is incorrect.
>
> May you provide an example of such problem?
>
> I just tried
>
> #+name: table1
> | 1 | 1 |
>
> | 2 | 2 |
> | 3 | 3 |
> | 4 | 4 |
> | 5 | 5 |
>
> #+name: table2
> | 1 | -1 |
>
> | 2 | -2 |
> | 3 | -3 |
> | 4 | -4 |
> | 5 | -5 |
>
> #+begin_src gnuplot :var x=table1 y=table2 :cache no
> plot x, y w l
> #+end_src
>
> And both the tables are correctly plotted.


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

* Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]
  2023-02-08 21:13   ` Thomas Worthington
@ 2023-02-09 10:58     ` Ihor Radchenko
  2023-03-29 13:15       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-02-09 10:58 UTC (permalink / raw)
  To: Thomas Worthington; +Cc: emacs-orgmode@gnu.org

Thomas Worthington <thomas.worthington@cosector.com> writes:

> I can't replicate now. It was about four weeks ago I tripped over 
> this and I absolutely saw it in action repeatedly - I could see 
> gnuplot loading the same file in its process buffer, and only one 
> file being created on-disc too.

One possibility is hash collision in `org-babel-temp-stable-file'.
Something similar to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56255

I will see if I can implement collision-free hashing to work around the
limitations of sxhash.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]
  2023-02-09 10:58     ` Ihor Radchenko
@ 2023-03-29 13:15       ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-03-29 13:15 UTC (permalink / raw)
  To: Thomas Worthington; +Cc: emacs-orgmode@gnu.org

Ihor Radchenko <yantar92@posteo.net> writes:

> One possibility is hash collision in `org-babel-temp-stable-file'.
> Something similar to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56255
>
> I will see if I can implement collision-free hashing to work around the
> limitations of sxhash.

Done, on main.
Fixed.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=88f7bea16

Emacs devs showed no interest in collision-free hashes, so I implemented
this in our org-macs library.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-03-29 13:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 17:41 [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)] Thomas Worthington
2023-02-08 13:33 ` Ihor Radchenko
2023-02-08 21:13   ` Thomas Worthington
2023-02-09 10:58     ` Ihor Radchenko
2023-03-29 13:15       ` Ihor Radchenko

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).