0

M-x org-groff-export-to-groff works fine (exports .groff file for the org-file)

However, when I try to compile pdf from org-file with (M-x org-groff-export-to-pdf) following error show:

Saving file /home/garid/test.groff...
Wrote /home/garid/test.groff
Processing Groff file test.groff ...
shell-quote-argument: Wrong type argument: arrayp, nil

Could you explain what go wrong?

FYI, I added following configurations to my init.el for ox-groff.

(use-package org-contrib)
(require 'ox-groff)

enter image description here

Garid
  • 545
  • 1
  • 13
  • 1
    `ox-groff` is buggy (that's why it's in the unsupported `org-contrib` package). Unfortunately, since there is no maintainer, there is no place to send a bug report. You will either have to fix it yourself (please submit any fixes you make by sending them to the Org mode mailing list: that way they will be available for everybody else), or ask at the Org mode mailing list, bearing in mind that it *IS* unsupported, so you may not get any response, or just use it to generate the `groff` file and then compile that by hand (I did the latter and it seems to work in a simple case). – NickD Nov 22 '22 at 17:16
  • 1
    BTW, the buggy function seems to be `org-groff-compile`. It uses a variable `out-dir` which is set to `nil` and then used in a call to `shell-quote-argument`; but `shell-quote-argument` cannot deal with a `nil` argument. – NickD Nov 22 '22 at 17:25

1 Answers1

1

I got it working with one change to the ox-groff.el file. Change line 1897 from this:

     ...
     (out-dir (file-name-directory file))
     ...

to this:

     ...
     (out-dir (file-name-directory full-name))
     ...

In fact, the master branch of the repo you were pointed to in your other question (https://git.sr.ht/~bzg/org-contrib) already contains this fix, in contrast to the 0.4 version of org-contrib that you get from the ELPA (nongnu) repository. So to that extent, my comment above was too pessimistic: things do get fixed (but it is still unsupported).

NickD
  • 27,023
  • 3
  • 23
  • 42
  • Thank you for your great response. Even after changing to `file` to `full-name`, I got same output – Garid Nov 23 '22 at 04:55
  • Did you reload the file after changing it? Or restart emacs? One way to check is to say `C-h f org-groff-compile` and then click on the link at the end of the first line, which will take you to the source code of the function; then scroll down and check that the line has indeed been changed. Once you are inside the function, you can do `C-M-x` to redefine the function, incorporating the change (assuming that it is present). – NickD Nov 23 '22 at 10:23
  • Yes I have have done `C-M-x` at the `org-groff-compile` function, close and re-open emacs. The result is same – Garid Nov 24 '22 at 03:34
  • 1
    Ah, Sorry, an update: when I start `emacs --daemon` I haven't noticed following lines: `Source file ‘/home/garid/.config/emacs/elpa/org-contrib-0.4/ox-groff.el’ newer than byte-compiled file; using older file` So `emacs` seems using the unchanged version of `ox-groff` – Garid Nov 24 '22 at 05:12
  • 1
    an Update; finally done it. According to [this question](https://emacs.stackexchange.com/questions/185/can-i-avoid-outdated-byte-compiled-elisp-files). With this line `(setq load-prefer-newer t)` added, my emacs uses newly changed `ox-groff-compile`, and it produces PDF as expected. Thank you – Garid Nov 24 '22 at 13:25