Questions tagged [kill-ring]
The kill ring is a global list of blocks of text that were previously copied or moved from buffers.
70
questions
0
votes
1
answer
35
views
Copy the value of a property in the properties drawer
I want to copy the value of a property in the properties drawer to the kill ring, so I can paste (yank) it with org-yank (for example). Something similar to what kill-ring-save does.
Currently, I have ...
0
votes
1
answer
71
views
Swap two pieces of text
I often find myself swapping pieces of text.
How can I make a command to replace the current text with the latest kill, then put the text I just replaced at the position of the previous kill?
Or is ...
0
votes
1
answer
16
views
Does kill-new take some time to put a string on the system clipboard?
I have an emacs function which calls kill-new to put a string onto the Windows system clipboard and then immediately invokes an external script to paste that string from the clipboard to an other ...
0
votes
0
answers
30
views
How do I correctly yank multiple lines using helm?
I'm fairly new to emacs and using Helm. I'm having trouble in the sense that I often kill expressions spanning multiple lines that I want to yank later, but then kill some
text I actually just want to ...
0
votes
1
answer
34
views
Is it possible to use counsel-yank-pop (or something similar) to get the job done of pasting from the clipboard-ring in the mini-buffer?
This is my emacs init file. As you see, I use command counsel-yank-pop. And I even did a keybinding for it with:
;; =counsel-yank-pop= enhances built-in =yank-pop=.
(global-set-key (kbd "M-y"...
3
votes
1
answer
22
views
save symbol under point to kill ring upon pressing isearch-forward-symbol-at-point
I want isearch-forward-symbol-at-point to also save to the kill-ring. How can I accomplish that please?
0
votes
2
answers
63
views
How to add a hook to save things on kill-ring (or clipboard ring) before a frame is deleted?
Context:
I have been using an interesting software called Emacs Anywhere. It helps me bring emacs keybindings for stuff like this (editing text for a question on Stack Exchange). Overall, the software ...
0
votes
1
answer
42
views
How to access the last-yanked text programmatically?
How can I use the last thing yanked in a command I'm writing?
For example, if the last text I yanked was "test" I want to use this string somehow in my command.
(I use avy and evil.)
1
vote
1
answer
266
views
How to clear the `kill-ring`?
I really like counsel-yank-pop. I like it so much that I have changed my keybindings so that C-y is bounded to counsel-yank-pop. However, after a while the kill-ring tends to become a big mess.
I ...
0
votes
1
answer
214
views
How to copy the output of command `pwd`, which is echoed in the echo area?
After executing the command pwd, Emacs minibuffer successfully returns the file location, for instance: Directory /home/pedro/projects/.
I can see that information. But I would also like to copy it.
...
2
votes
1
answer
182
views
Modify the first element of the kill-ring
I have stored in my clipboard a path to an image, which I want to paste inside emacs.
I would like to modify the path to change/postpone/prepone some stuff before yanking.
Following my previous ...
1
vote
1
answer
169
views
Storing some text from a buffer into a variable
What is the "standard" way to store some text obtained from a buffer into a variable?
The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) ...
2
votes
1
answer
92
views
How to replace the first element of the `kill-ring` by a modification of it?
I am trying to modify the string that is to yanked
My goal is to modify certains paths before yanking, in order to transform them in relative to path actual buffer file.
Following this post, I tried ...
1
vote
1
answer
54
views
A way to check if "(current-kill 0)" will run onto an error before it happens
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 ...
1
vote
3
answers
195
views
How to display list of previous copies/kills (`M-w` or `C-w`)?
C-n C-y retrieves the n-last call to C-w, I think. Is there a way to show all that were saved?
0
votes
1
answer
124
views
How to pass the result of yank to find-file?
So I wanted to basically copy the current selection, then yanking it into find-file, as when using:
C-SPC: set-mark-command
M-w: kill-ring-save
C-x C-f: find-file
C-y: yank
While that works great, I ...
1
vote
1
answer
84
views
Yanking does not use top entry in the kill ring
I want to delete regions without adding them to the kill ring following this thread:
(defun backward-kill-word-no-kill-ring ()
"Delete the previous word and remove it from the kill ring."
(...
1
vote
2
answers
69
views
Cutting only after I paste
Is there a way to cut text in such a way that it is only removed from the buffer when I paste it somewhere else?
I find myself often losing the text I had cut because, after I cut, I find out I need ...
0
votes
1
answer
168
views
comment-kill for entire region
Is there a similar command to comment-kill that kills all comments in a given region and saves them to the kill ring?
-1
votes
1
answer
244
views
mark-whole-buffer followed by kill-ring-save not working correctly
I'm using Emacs 26.1 on MacOS. Instead of copying the entire buffer I get a warning:
Saved text until "text where is
stopped saving with whitespace
seemingly to the end of the buffer
"
I'm ...
1
vote
2
answers
255
views
Rotate the yanking ring
I have such a table
| C | M |
|---------------------+---------------------|
| Character | Word |
|---------------------+----------...
4
votes
1
answer
100
views
How to copy output from ess to the kill ring?
Q: how can I automatically copy output from ess to the kill ring?
Background
I use ess to conduct statistical analysis. On occasion, I need to copy its raw output into another buffer (usually ...
0
votes
1
answer
76
views
Why isn't the flushed output from my Emacs shell buffer getting into the kill ring?
Following the advice given on p. 121 of Learning GNU Emacs, 2nd Ed.,
I'm entering the command sequence: C-c C-o, immediately after executing a command in my Emacs shell buffer.
And I'm seeing the ...
3
votes
0
answers
46
views
string-rectangle command pollutes kill-ring after upgrade to Emacs 25
In Emacs 24 I used to have a workflow for inserting a string into multiple lines at once:
Go to the desired position in the first line.
Press C-Space to place the mark.
Go to the last line (while ...
0
votes
1
answer
181
views
Trying to copy everything between double quotes, and then make a list of everything that was copied
So I have a defun that I made that is supposed to copy every thing that is between double quotes and then make a list of everything that was copied. I don't know what the problem is, but it doesn't ...
0
votes
0
answers
67
views
Unable to run browse-kill-ring
After installing the browse-kill-ring package under Emacs 24.5.1, I get the following error when running the browse-kill-ring command:
font-lock-set-defaults: Wrong type argument: symbolp, (font-...
0
votes
0
answers
92
views
helm-show-kill-ring disregards the selection
When I select entries (with C-<SPACE>) in helm-show-kill-ring and press either Enter or F1, it disregards the selection and yanks the entry currently under cursor. Why would this be the case and ...
2
votes
1
answer
255
views
yanking earlier kills not working
I followed the tutorial verbatim and I am unable to yank earlier kills. I have looked online for support, but noone else seems to have this problem.
Kill a line, move around, kill another line.
...
0
votes
1
answer
89
views
Yanking line copies past kill-ring lines along with current
I'm using Emacs to create text to copy to another program, but I need to copy line by line. I'm using a variation of kill-ring-save I provide below.
(defun my-kill-ring-save ()
(interactive)
...
1
vote
2
answers
94
views
save-whole-line
kill-whole-line works as I want. It cuts the line, and when I'm in org-mode it cuts the whole collapsed subtree.
What I need is just that as copy instead of cut. There is a multitude of suggestions ...
1
vote
1
answer
697
views
How copy content of minibuffer to kill-ring?
Windows 10, Emacs 25, Helm
How copy content of minibuffer to kill-ring?
0
votes
0
answers
547
views
Wanted: vim-like paste behavior from browse-kill-ring
When using the browse-kill-ring package to insert some text from the kill ring, the text always gets inserted before point.
This is not intuitive to vim users who are used to pasted text being ...
2
votes
5
answers
153
views
Gathering scattered text to a single location
I am looking for an easy way to gather blocks of text that are scattered throughout an emacs or org-mode document and move (or copy, but move would be preferred) them to a single location.
(For ...
1
vote
2
answers
53
views
How to capture show-paren-mode region into the kill ring?
I'm enjoying show-paren-mode using the "expression" style, which highlights a parenthesized region in a contrasting color. I'd like to define an Emacs Lisp function that could capture the region into ...
0
votes
1
answer
189
views
evil "exchange-with-kill-ring"-operator?
I often find myself wanting to exchange some text object with whatever's currently in CLIPBOARD (not necessarily in Emacs' kill-ring, when I copy from other programs). But of course when I do ...
3
votes
2
answers
950
views
Copying a rectangular selection to system clipboard
Does anyone know a command or somtething to copy an rectangular selection (as with C-x r M-w / copy-rectange-as-kill) and put the killed rectangle into the system clipboard like with the kill-ring-...
1
vote
2
answers
690
views
What's the most efficient, idiomatic way to paste-and-replace in Emacs?
I often do something like this:
Copy some stuff
Go to where I need to paste it
Paste it (C-y)
Kill the rest of the line (C-k)
Select what I just pasted, and copy it again
Repeat steps 2-5
The whole "...
1
vote
1
answer
319
views
How can I use magit to diff some text with my clipboard?
I see others doing this in there IDEs is there a way to highlight a file or some text in a file and diff it with whats in my clipboard/kill-ring ?
0
votes
2
answers
88
views
Function to duplicate and mark duplicated text
In order to be able to chain the following command, I need the yanked text to be marked. That is because the end goal is to call (pop kill-ring) so that I can still use whatever was at the top of the ...
0
votes
4
answers
3k
views
how can I get Emacs kill-ring to behave like a simple clipboard buffer?
How can I get Emacs to behave the same as other programs for copy/paste (i.e. OpenOffice, Microsoft Word, etc.)?
I want to simplify the kill-ring so that it behaves like a simple clipboard. I find it ...
2
votes
1
answer
838
views
How to send *shell* stdout directly to kill-ring?
Suppose that I have a *shell* buffer (i.e. a subordinate shell, started with M-x shell). Suppose also that at this shell's prompt, I can execute some command foo that sends some output to stdout.
I ...
2
votes
2
answers
7k
views
Paste Windows clipboard with Shift-Insert but not by yanking
I am using Emacs 24.4 on Windows 10. I only ever use it in -nw (no-window) mode.
I would like Emacs to paste from the Windows clipboard only on Shift-Insert and not on yank (Ctrl-y). I have tried ...
1
vote
1
answer
1k
views
What is the difference between kill-ring-save and copy-region-as-kill?
These two commands seem identical to me. What am I missing?
1
vote
0
answers
51
views
Launch functions one after another
I wrote a function that pastes in the currently selected color from the palette to the buffer:
(defun palette-paste-in-current-color ()
(interactive)
(cua-paste (palette-current-rgb-to-kill-ring))...
12
votes
4
answers
3k
views
How do I yank and cycle backward through earlier killed text?
Emacs has this very handy kill-ring that can be cycled through after yanking, by pressing M-y repeatedly. Is there a way to switch the cycling direction? So I don not need to cycle through all when I ...
9
votes
4
answers
3k
views
In Evil mode, how can I prevent adding to the kill ring when I yank text, visual mode over other text, then paste over?
If I have text1 text2, I yank text1 with yw then I highlight text2 with vw and paste overwrite that text with p, my kill ring now has text2. I'd prefer if text2 wasn't added to my kill ring because ...
2
votes
2
answers
195
views
How to avoid double M-y with system clipboard integration in the terminal
I added Mac clipboard integration to my emacs -nw using the following code, adapted from here:
(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osx (text &optional ...
11
votes
5
answers
1k
views
Calc: copy only a value, not stack number
This seems so obvious that I feel sure that I've just missed something in the manual. I frequently do a calculation and then want to use that calculation elsewhere. But let's say my stack is currently:...
13
votes
4
answers
3k
views
Backspace without adding to kill ring
Using Crtl+Backspace or Ctrl+Del adds the deleted text to the kill ring.
How can I prevent this from happening? I do not need to have every single piece of text sent to the kill ring when it gets ...
3
votes
1
answer
82
views
kill-region deletes entire buffer content instead of selected text
In emacs, i have a small text selected as shown in the picture.
When i do eval-buffer, i like the kill-region to remove only the highlighted text. But this code empties the buffer.
;;this is a ...