Questions tagged [kill-ring]

The kill ring is a global list of blocks of text that were previously copied or moved from buffers.

Filter by
Sorted by
Tagged with
2
votes
1answer
28 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 ...
0
votes
0answers
29 views

Mark considered active after kill-ring-save even though it’s not

I’m having a small issue with a minor mode I’m writing. I’m using mark-active within pre-command-hook and post-command-hook in order to know whether a command just enabled/disabled the mark/region (I’...
1
vote
1answer
25 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
1answer
48 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
1answer
19 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
3answers
56 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
1answer
75 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
1answer
63 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
2answers
58 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
1answer
66 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
1answer
147 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
2answers
111 views

Rotate the yanking ring

I have such a table | C | M | |---------------------+---------------------| | Character | Word | |---------------------+----------...
4
votes
1answer
72 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
1answer
52 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
0answers
42 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
1answer
90 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
0answers
52 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
0answers
67 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
1answer
179 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
1answer
70 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
2answers
82 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
1answer
400 views

How copy content of minibuffer to kill-ring?

Windows 10, Emacs 25, Helm How copy content of minibuffer to kill-ring?
0
votes
0answers
406 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
5answers
122 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
2answers
44 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
1answer
154 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 ...
2
votes
2answers
560 views

Copying an 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
2answers
464 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
1answer
209 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
2answers
74 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
4answers
2k 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
1answer
564 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 ...
1
vote
2answers
6k 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 ...
0
votes
1answer
771 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
0answers
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))...
10
votes
4answers
2k 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 ...
6
votes
4answers
2k 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
2answers
161 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 ...
9
votes
5answers
584 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:...
12
votes
4answers
2k 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
1answer
77 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 ...
2
votes
1answer
347 views

How to stop C-backspace or M-backspace from copying text?

Deleting a chunk of text from the cursor causes the deleted contents to be copied into the kill ring, overwriting whatever I had stored there. How do I stop this from happening?
13
votes
1answer
591 views

How to copy text without losing selection?

When I copy some selected text (kill-ring-save with M-w), I automatically lose my selection. I have tried with Transient Mark Mode with no luck. (Note that I'm not using CUA Mode.)
10
votes
2answers
2k views

How can I use Helm File Finder to copy a file path to a buffer?

Is there a way, in the buffer launched from helm-find-files, to copy a file path to the kill ring?
4
votes
0answers
177 views

What is the distinction between copying text between a region BEG/END, and copying a region?

I was trying to add a custom functionality when using C-u before the "copying" command or kill-ring-save. So I jumped into the source code (pasted below for convenience) to examine what it originally ...
0
votes
2answers
217 views

Copy current line if there is no active region [duplicate]

I wrote this custom function to copy the entire line, if no mark is set (defun sk-copy-ops (beg end) (interactive "r") (if mark-active (kill-ring-save beg end) (kill-ring-save (line-beginning-...
8
votes
3answers
716 views

How to push system clipboards to kill ring contents at real-time when I copy outside emacs?

I noticed that when I copy thing outside of Emacs, the thing does not appear to kill ring immediately except I yank it to Emacs. If I copy twice, only the last copy can be got by yank. Sometimes, I ...
7
votes
4answers
3k views

How can I copy syntax highlighted code as RTF or HTML?

I'm using Emacs to write code samples that I later want to be able to paste into a MS-Word document, preserving the syntax highlighting. I understand that in order to do this I need to copy the text ...
1
vote
0answers
22 views

Copy buffer absolute file path to the system clipboard [duplicate]

How can i copy the absolute path of the current open buffer to the system clipboard (i.e. ctrl + shift + v) and not (ctrl + y) There are many solutions available for such copy, 1 and 2 but all of ...
4
votes
2answers
832 views

how to push kill-ring contents onto system pasteboard (clipboard)?

I use the brilliant answer from my previous question to copy selected regions of text from Emacs onto my system pasteboard (i.e. the OSX clipboard). But some functions (e.g. gist-buffer) push output ...