0

as I already told I've installed rst2pdf docutil, but if I run

 M-x rst-compile-pdf-preview

I get a quick message saying that Ive to use C-c C-c C-p but, entering that, I obtain

You can run the command ‘rst-compile-pdf-preview’ with C-c C-c C-p

and if I made that I do not obtain nothing What I still have to do?

Thank you

Renato

2 Answers 2

1

rst2pdf convert the document to a PDF file and launch a preview program.

Maybe emacs doesn't find the preview program (maybe you don't have xpdf installed or not in your path)

8
  • it's like the compilation doesen't start. I just receive the message "You can run the command ‘rst-compile-pdf-preview’ with C-c C-c C-p". but if I also type it I have no feedback. The file.pdf is no produced.
    – RenatoP
    Aug 3 at 10:53
  • Do C-x b *Messages* to visit your *Messages* buffer and see if there are any error messages that might help you.
    – NickD
    Aug 3 at 12:48
  • Mark set Beginning of buffer [50 times] End of buffer [32 times] Beginning of buffer [36 times] <nil> <wheel-left> is undefined ren.rst has auto save data; consider M-x recover-this-file Making completion list... You can run the command ‘rst-compile-pdf-preview’ with C-c C-c C-p End of buffer [14 times] Beginning of buffer [7 times] I cannot read anythings bad here. Do you?
    – RenatoP
    Aug 3 at 13:53
  • Nope - you'll have to dig deeper...
    – NickD
    Aug 3 at 14:40
  • I've never told that I'm working on Mac Osx 12.5 . Could it be important?
    – RenatoP
    Aug 4 at 8:55
1

The problem is probably incomplete or incorrect setup of the rst utilities (and possibly xpdf).

So forget about Emacs for the moment. Open a terminal running a shell and type this command:

rst2pdf myfile.rst myfile.pdf

where myfile.rst is your input file. Did that produce a PDF? If not, you have to fix that first: do not go on until you can complete this step successfully.

When you have produced a PDF successfully, then try to preview it with this command:

xpdf myfile.pdf

Did that show you the PDF? If not, you have to fix this first: do not go on until you can preview the PDF.

Once both of these steps are successful, then, and only then, you can go back to Emacs: do C-x C-f myfile.rst and then do C-c C-c C-p. The command that is executed under the covers will be similar to this:

rst2pdf /tmp/rst/myfile.rst /tmp/rst_elikNHBA.pdf && xpdf /tmp/rst_elikNHBA.pdf ; rm /tmp/rst_elikNHBA.pdf

which is basically a combination of what I showed above. But note that the PDF is produced in a temporary file which is removed after the preview.

EDIT: The OP states in a comment that the two steps above go well, but when he visits the file in Emacs and does C-c C-c C-p nothing happens. So we have to turn to debugging what Emacs is doing.

In the buffer of myfile.rst, is the major mode reported as rst-mode? You can check if that is the case, with C-h v major-mode but be careful to do it in the correct buffer, that of myfile.rst. It should say:


Its value is ‘rst-mode’
Original value was ‘fundamental-mode’
Local in buffer myfile.rst; global value is fundamental-mode

Does it? If not, either your emacs does not include the rst.el library or your auto-mode-alist does not know that files with the rst suffix should be in rst-mode. Neither of these is likely but you never know. BTW, please add the Emacs version to your question: do M-x emacs-version to find it. You should always include the version in any question you ask in the future.

In that same buffer, do C-h k C-c C-c C-p - it should say:

 C-c C-c C-p runs the command rst-compile-pdf-preview (found in
rst-mode-map), which is an interactive compiled Lisp function in
‘rst.el’.

Does it?

If both of those are correct, it should all work: the file should be compiled into a (temporary) PDF file and xpdf should open it for viewing; when you close xpdf, the PDF file is removed. Note that while xpdf is open, the PDF file still exists, so you can sneak in from a terminal and copy it somewhere else for safekeeping - it's only when xpdf is closed that the PDF file is removed.

If it still does not work, then the only recourse I can suggest is to run the command under a debugger to see what's going on.

Also, if nothing happens, take another look at the *Messages* buffer and see if there is anything of note in there. I would expect either success or an error message.

I should also mention that I've tried all this on my system and it works fine.

10
  • the first steps goes well, xpdf myfile.pdf show with xpdfreader the file But when on emacs I type C-x C-f myfile.rst and the C-c C-c C-p, nothing appens
    – RenatoP
    Aug 3 at 16:59
  • Added some suggestions for debugging the Emacs side, since the system side seems OK.
    – NickD
    Aug 3 at 17:52
  • emacs 28.1. When I run
    – RenatoP
    Aug 5 at 15:06
  • - emacs 28.1 - C-c C-c C-p runs the command rst-compile-pdf-preview (found in rst-mode-map), which is an interactive compiled Lisp function in ‘rst.el’. It is bound to C-c C-c C-p. (rst-compile-pdf-preview) Convert the document to a PDF file and launch a preview program. I have the suspect that xpdf is not binded to emacs. on my mac previw program is the defaul program to open .pdf. How can I be sure that when I type C-C C-c C-p the command to create a .pdf are give to emacs?
    – RenatoP
    Aug 5 at 15:12
  • What does C-h v rst-pdf-program say? It should be xpdf by default, but maybe it's different in your setup?
    – NickD
    Aug 5 at 15:27

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.