I run emacs with a common configuration on osx and linux. I have some custom functions that need to get access to the GUI clipboard. I find interacting with the clipboard a bit of pain - so I've resorted to things like
(shell-command-to-string "pbpaste || xclip -o")
Is there a correct way of doing this (i.e. a single function that intends to work across all GUIs which someone else maintains?).
This came up again in the context of working on a script that might in theory become a library that is shared with other people - so I would prefer not to use hacks in it (though I am currently putting a hack into it).