I have an Elisp part involving (current-kill 0)
to copy the current clipboard content into a variable. This works flawlessly as long as the kill-ring has content. However, if I just started the computer and did not copy anything yet (or use the command-line version of Emacs), running that script runs into the error "Kill ring is empty".
Trying (cond (kill-ring) my_code)
seems dodgy since when starting Emacs and before (current-kill 0)
is executed, kill-ring
is actually nil as per C-h v kill-ring
.
Is there a reliable way to find out if the clipboard actually holds content without getting the code running onto an error?