Why Nostr? What is Njump?
2023-08-15 10:58:59

Ramin Honary on Nostr: #Emacs tip of the week This is a two-for-one, these are two tips that I can't believe ...

#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.
Author Public Key
npub1ft5hkgyyu2ev80qh8pw2ggtecawfza7zlmm0pwvuvhapwll568aq0ychga