The prin* Family

This is really a note to myself but I’ll bet many of you are in the same boat. When I want to print something in Elisp, I usually use format but sometimes one of the prin* functions is really what I need. The problem is that I can never remember exactly what they do. What, for example, is the difference between princ, print, and prin1?

This post is meant to be a cheat sheet for the family. Although it’s not really part of the prin* family, I’ve included pp as well because I always forget about it.

  • prin1
    Output a printed representation of the argument with quoting. Output will be readable if possible.
  • prin1-char
    Return a string representation of the argument, which must be a character.
  • prin1-to-string
    Return a string representation of the argument with quoting. Like prin1 but returns the string rather than outputting it. Output will be readable if possible.
  • princ
    Output the printed representation of the argument without quoting.
  • princ-list
    Print all arguments with princ followed by a newline. OBSOLETE: Use mapc and princ instead.
  • print
    Output the printed representaton of the argument with newlines around it. Output will be quoted and readable if possible.
  • print-buffer
    Paginate and print buffer contents.
  • print-diary-entries
    Print a hard copy of the diary display.
  • print-help-return-message
    OBSOLETE: use help-print-return-message instead.
  • print-region
    Paginate and print the region contents.
  • pp
    Output a pretty-printed representation of the argument with quoting. Output will be readable if possible.
This entry was posted in Programming and tagged . Bookmark the permalink.