Questions tagged [yank]
Emacs' name for 'paste' (the one that goes together with copy).
79
questions
1
vote
1
answer
57
views
Searching for text fragments by character text properties
The text to be processed has special words marked with a special font.
The required text is copied to the clipboard with the mouse (from firefox). The text is pasted into the clipboard
emacs("...
1
vote
2
answers
39
views
can't use `isearch-yank-word-or-char` in minibuffer-local-map?
I'd like to have occur's prompt in the minibuffer do the same that isearch does: C-w inserts the word at point in the main buffer into the minibuffer prompt. That keybinding, when doing isearch, calls ...
1
vote
0
answers
38
views
How can I keep the default `yank-pop` behaviour after installing swiper?
Swiper replaces the behaviour of the M-y command (yank-pop) with its own implementation, which shows the contents of the kill ring.
I like the default behaviour of M-y prior to installing this package ...
0
votes
1
answer
58
views
How to bring the deleted region back if I abort yanking with `M-y`?
I have the following configuration in my init.el:
(use-package delsel
:demand t
:config (delete-selection-mode +1))
When I do yank-pop with M-y while a region is selected, it deletes the ...
0
votes
0
answers
37
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 ...
1
vote
1
answer
228
views
How to transpose a pair of words?
Suppose I have the following text:
:lacerte-attach-statement-type "suffix" :data-automation-id "OSICtrlE15-140"
And I would like to have:
:data-automation-id "OSICtrlE15-140&...
0
votes
1
answer
39
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"...
0
votes
1
answer
67
views
how to move `consult-yank-pop` selected entry to top of kill ring after selection?
I'm using the package consult, so after I press M-y (consult-yank-pop) without pressing C-y (yank) first, I get a list for me to choose. Say, I get the list in the kill ring as
a
b
c
d
If I navigate ...
2
votes
2
answers
390
views
How to repeat the last yank command N times?
I'm just not able able to replicate the answer on this. Starting with:
lipsum
I do (my interpretaton):
Alt-W over the word (copy)
Enter (new line)
Ctrl-Y (paste)
Alt-2 Ctrl-X z (repeat last two ...
0
votes
1
answer
50
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.)
0
votes
2
answers
204
views
Default yank keyboard shortcut does not work
I am using Emacs 27.1 (GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-03-28, modified by Debian).
When I hover the mouse pointer over the "copy&...
1
vote
3
answers
251
views
How to yank character under cursor?
I want to copy just one character underneath the cursor. Its not ascii, so I can't type it. Is there a function or key that allows for this?
Vanilla emacs welcome, though evil and spacemacs answers ...
0
votes
1
answer
60
views
How to modify text that's yanked?
I copy text from websites and paste/yank into emacs buffers. But this text sometimes has silent hyphens in them. The behaviour when copying and pasting text with soft hyphens in it varies across ...
3
votes
1
answer
175
views
How to have yank visually flash the pasted text
I'd like to be able to paste text into a buffer and have emacs give a visual confirmation by flashing the region (highlighting and unhighlighting) the text that was pasted in the buffer. Is there an ...
0
votes
1
answer
71
views
Spacemacs, Lisp, Pasting and the missing Space
When editing Lisp or Clojure in Spacemacs (Emacs with Evil) I find the pasting behavior anoying. Say I have yanked bar and want to paste it as a parameter to (foo) so I get (foo bar). The problem is, ...
5
votes
3
answers
339
views
Removing unwanted colors (and other decorations) from yanked text
I have a Java properties file that, when opened with Emacs, shows up in a color coded form, as below:
I also have a simple text file.
When I yank something from the properties file into the text file,...
2
votes
2
answers
878
views
Possible to access the second-last clipboard contents (clipboard history)
Is there a way to access the second last value of the clipboard in Emacs?
I assume it's possible to make this work within Emacs.
Intercept the copy function.
Read the clipboard and add it to a list.
...
1
vote
1
answer
117
views
kill-ring-save rectangle and paste transposed?
Suppose I have some code written like:
a_to_b = self.tversky(a, b)
b_to_c = self.tversky(b, c)
d_to_e = self.tversky(d, e)
e_to_f = self.tversky(e, f)
g_to_h = self.tversky(g, h)
I would like to ...
1
vote
1
answer
86
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."
(...
0
votes
1
answer
229
views
wrong-type-argument from insert yank
I'm looking for ways to get the last copy from the kill ring in Emacs.
I run
(insert (yank))[cursor]
with C-x C-e and I get this *Backtrace*:
Debugger entered--Lisp error: (wrong-type-argument ...
2
votes
2
answers
1k
views
How to save clipboard or (car kill-ring) as string
OS Debian GNU/Linux 7
emacs-24.3
I want to save the content of the clipboard or the last item of the kill-ring (depending whats newer) as a string so that I can do stuff with it in a eLisp function. ...
7
votes
1
answer
608
views
How to stop web-mode from reindenting after yank?
I'm editing this code:
callFunction({
x: somearray,
});
Then I want to extract somearray to be a variable with a copy. I cut somearray and delete the colon, then enter (_ is the cursor):
const ...
1
vote
1
answer
83
views
Highlight yanked region during sequence of yank-pop's until mark is moved away
I sometimes find myself yanking a large chunk C-y and then cycling M-y through some previous kills. This can feel visually noisy to me, i.e. during the sequence of replaces it's easy to lose track of ...
1
vote
2
answers
267
views
Rotate the yanking ring
I have such a table
| C | M |
|---------------------+---------------------|
| Character | Word |
|---------------------+----------...
0
votes
1
answer
78
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 ...
0
votes
1
answer
132
views
Using a predefined Regex on a yank
can you please help me to write a small emacs function? This is the first lisp function I am writing and I think I am getting confused with point and mark placement.
I want to write a function that ...
5
votes
2
answers
959
views
How can I yank images from Emacs?
I want to copy images from Emacs to macOS clipboard. I have tried selecting them and yanking, which hasn't worked. Google also didn't have a solution.
0
votes
1
answer
185
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 ...
2
votes
3
answers
182
views
adhoc emacs Elisp command to send emacs clipboard text to osx clipboard
When you press 'y' (elfeed-search-yank) in an elfeed-search buffer, the selected entry's permalink url is copied to the emacs clipboard.
I don't have any automatic clipboard sync packages installed, ...
1
vote
2
answers
183
views
How to get mouse copy like done on Lisp Machine Zmacs/ZWEI?
I'd like my emacs v25.3.1 running on Mac OS X to have a mouse middle button functionality that copies what you mouse middle on to the insertion point in your buffer. This is great when writing code ...
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
259
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.
...
3
votes
1
answer
304
views
after previous `counsel-yank-pop`, `yank` the last yanked entry
short: after a counsel-yank-pop, yank does not yank the same entry. How can I achieve that behavior?
long: Having a kill-ring like:
foo
bar
baz
When doing a C-y (yank) and M-y (yank-pop) 'bar' ...
0
votes
1
answer
169
views
Can I programmatically get access to the yanked region?
You are likely to want to do things to the text that you just yanks / pasted (wrap it in brackets etc).
Is there a way to know what you just yanked? If so I would quite like select it (put the mark ...
1
vote
3
answers
91
views
quickly kill and then yank parts of a program
I very often encounter the problem that I have to cut out a part of an expression and need to copy it somerhere else. For example the following python line:
courtage_text = data["expose"]["brokerage"]...
2
votes
5
answers
155
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
731
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 "...
3
votes
1
answer
299
views
Copy non-printable characters as displayed by Emacs
Very similar to this question: Copy text as it is rendered by Emacs but what I need is to coy the ^M, ^E and so on characters as they are displayed. (Otherwise the text in clipboard gets truncated).
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
0
answers
112
views
dealing with s-expressions in javascript without paredit
I was using paredit for other languages apart from lisp and it was great for being able to delete and yank whole functions etc. but it was also quite buggy with web-mode and js2-mode.
Fir example, I ...
0
votes
1
answer
151
views
Accidental yank or paste into org buffer
EDIT: I closed and reopened Emacs again and the same behavior happened. But this time the text inserted was from my last kill or M-w—(add-hook 'before-save-hook 'time-stamp)—to copy it to the system ...
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 ...
2
votes
1
answer
167
views
What is the problem with this yank function in elisp in emacs?
Idea I will like to construct a simple emacs function that copies the yy functionality in vim.
The function should yank a visual-line into kill ring without deleting the line.
Function
Here is ...
1
vote
1
answer
237
views
How can I change yank/delete to show relative line numbers during the yank/delete in evil?
I use evil via spacemacs. When I use yank, it’s mostly whole line numbers – like y20y. To a lesser extent, this is often true of delete – d10d
Is there anything I can add to my Spacemacs config to ...
2
votes
1
answer
107
views
isearch looses focus when trying to paste into the isearch buffer
strange issue. when i launch isearh and want to paste text into it, after pressing C-s the paste (S-insert) always pastes the text to the current edited buffer and not the isearch window. has anyone ...
2
votes
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
1
answer
277
views
I got error when using command yank
When I typed C-y to call yank, I got this.
apply: Symbol's value as variable is void: n
Debugger entered--Lisp error: (void-variable n)
ad-Advice-current-kill( ... [interprogram-paste-function ...
3
votes
1
answer
1k
views
Copy current URL from web browser from Emacs while editing
When editing code or org-mode, I often need the URL of the page I'm viewing in Google Chrome. Is there a way to do this from Emacs? Or with an external helper script if necessary?
An example use ...
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 ...
1
vote
2
answers
182
views
Kill and yank (append?) text from buffer to bottom of same buffer
I want to be able to kill selected text and yank it to the bottom of the buffer from which it was killed.
How do I do this efficiently, meaning not with C-k, moving point to end of buffer, C-y?