Post
#Emacs tip of the week This is a two-for-one, these are two tips that I can't believe I never learned about it until now. What is an easy way to see the value of a variable, or see the result returned from a function call? You might know about the M-: (Alt-Colon) command, which lets you run any Lisp code, the result is printed into the *Messages* buffer. But... if you use the prefix command C-u (Control-U) and then press M-: (Alt-Colon), the result returned by the Lisp code is printed into the current buffer after the cursor. Even better, however is using the (pp) ("Pretty-Printing") function. This also outputs to *Messages* by default, but it takes 2 arguments, the second of which can be a buffer. Try this code: (pp (buffer-local-variables) (currrent-buffer)) The result returned by (buffer-local-variables), which is a list of all buffer-local variables and their values, is pretty-printed right after the cursor.
Obnoxious Alpaca Or, you can switch to the scratch buffer and hit C-j to evaluate and print the preceding expression. With the added comfort of having all the transcript of the hacking session on hand. Happy *scratch*ing!