I would like to write a function that pretty-prints the current source code block into a PDF. I know I can use ps-print-region-with-faces, but it would require that I first select the source code block.

Is there a function in org to do this selection?

thank you in advance


the answer is org-babel-mark-block (answered by bertfred in a comment)

org-mark-element selects the block but also selects the BEGIN_ END_ markers.

  • 3
    org-babel-mark-block ? – bertfred Sep 9 '17 at 14:24
  • @bertfred can you post an answer? – user12563 Jul 29 '19 at 4:21

Unlike org-mark-element, the function org-babel-mark-block only selects the contents of a block.


org-mark-element should be able to do the right thing. It's bound to M-h by default.

  • Unfortunately this selects also the headers of the block (#BEGIN_SRC, #END_SRC) – dmg Sep 10 '17 at 3:49
  • 1
    Yeah, org-babel-mark-block (from a comment above) selects only the contents, which is also what I came here looking for. – Paul Bissex Mar 26 '18 at 20:38

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.