Copying from Emacs (select a line, y) to the system clipboard or pasting (p) from the clipboard to Emacs does not work. I have wl-clipboard installed and copying between Neovim works with some configuration.
I’ll just point out that that code snippet works (I’m still using it). I assume it must be something related to your Emacs/Doom config. Unsure how to debug though.
Copy and pasting to and from Emacs is configured also by other variables. Here they are (with the values I see in my config):
select-enable-primary nil
select-enable-clipboard t
x-select-enable-primary nil
x-select-enable-clipboard t
xclip-select-enable-clipboard t
@jman I am new to Emacs. How do I get the values for them?
You can see my config here (without the any of the wayland copy and paste code currently):
I tried the Wayland snippet from the EmacsWiki. It had no effect at least in pasting in text from the clipboard. Are you sure you do not have something else? My config is pretty minimal as you can see above.
To get the value of any variable in Emacs you can run M-x describe-variable, so for example you would run M-x describe-variable RET select-enable-primary (RET means press Return). You will get the current value and a bit of documentation.
These variables I mention are not Doom specific, it’s standard Emacs stuff and as far as I know that snippet is all there is to enable copy&paste on Wayland (I’m also not an Emacs guru, so maybe I’m missing something else).
Also ensure to reload your Doom configuration after changing it. Either with M-x doom/reload or restarting Doom.
Related: Emacs is completely introspectable, at this link a list of describe-* commands I find useful.
That could hint at a problem when you try to evaluate (i.e. run) that configuration snippet. Every variable in the config: block should be assigned a value:
xclip-program
xclip-select-enable-clipboard
xclip-mode
xclip-method
Please try to manually assign a value to xclip-select-enable-clipboard by evaluating this snippet: (setq xclip-select-enable-clipboard t).
(you can quickly evaluate any lisp code snippet by positioning the cursor after the last closing parenthesis and then run C-x C-e), then check the result with M-x describe-variable as described above. Evaluating code like this is ephemeral and will only last until the next Emacs restart.
(btw apologies for my overly didactical instructions, they are not meant to be offensive, just trying to keep them as easy as possible since you mention you’re new to Emacs).
Thank you @jman. I appreciate the overly didactical instructions. They are useful for a newcomer.
That last line + your code in the previous post got pasting into Emacs working for both GUI and terminal mode Emacs. I use alias e='emacs -nw' in my dotfiles.
However, when I try to copy (yank) out of terminal Emacs it does not copy to the clipboard. GUI Emacs, with copying out to the clipboard, does work.
My changed code is listed as below for my config.el
Now, why yank&kill work in GUI mode but not in text mode for you?
I’m pretty sure that also the variable xclip-mode in your config is not set to t but it’s nil. Please check if that’s the case and if yes evaluate the snippet (setq xclip-mode t). It should make copying work also in emacs no-GUI.
If that solves, now you will notice how strange is that you have to define these variables again outside of the :config block of the xclip package. This should not be needed. Unsure though why the xclip configuration snippet doesn’t work in your config