1

Due to a bug, I want to execute LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 gnuplot instead of just gnuplot to create plots with gnuplot. I already put an alias in my zsh source file, so that when I run gnuplot from a terminal the correct version is loaded.

However, emacs's org-mode seems to be still using the old gnuplot version. How can I specify the correct version to be used? I already looked into ob-gnuplot.el trying to find the place where the command to execute gnuplot is saved, without luck.

  • Have you tried making a wrapper script and putting it somewhere in your PATH? (Be sure to check whether Emacs uses the same value for PATH). – DoMiNeLa10 Jul 11 '18 at 16:10
  • @DoMiNeLa10 I'm not sure if I've done it correctly, but I just tried it. I created a script named gnuplot with a single line (LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 gnuplot "$@") and put it in two directories listed in exec-path (in one listed after and one listed before /usr/bin as I don't know in which order the dirs in PATH are worked through). It doesn't work either. When running the source blocks the minibuffer says something with gnuplot 3.7, while in my system 5.0 is installed, so perhaps emacs has its own version somewhere – Robe Jul 12 '18 at 7:07
  • You can evaluate (executable-find "gnuplot") in Emacs to see which executable it'll pick up from PATH. If you want to check in a shell, there's the which command there. – DoMiNeLa10 Jul 12 '18 at 15:46
  • @DoMiNeLa10 Thanks! I found the problem: I should have specfied the full path in the script LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 /usr/bin/gnuplot "$@". In the original state it was entering a loop calling itself again and again. If you want to add the "Create a wrapper script" as an answer I'll accept it – Robe Jul 12 '18 at 17:44
1

The most robust solution would be to write a wrapper and putting it in your PATH so it overrides the binary you'd normally run.

You can check the result of PATH lookup with which in shells and with the executable-find function in Emacs.

In your case, the following script will do the job:

LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 /usr/bin/gnuplot "$@"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.