Questions tagged [yank]

Emacs' name for 'paste' (the one that goes together with copy).

Filter by
Sorted by
Tagged with
19
votes
1answer
3k views

Emacs doesn't paste in Evil's Visual mode with every OS clipboard

Setup: GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL Compiled from EmacsW64. Package Evil, using the latest version of Evil from MELPA Windows 7 x64 bit. Situation: ...
12
votes
2answers
347 views

What is the origin of the term “yank”?

I'm interested in learning how the term "yank" got its name. I'm also interested in why Emacs "yank" differs from vi/vim "yank". See also: dual question about Vi, also on Unix & Linux;
8
votes
4answers
483 views

Fastest way to move code block to specific line

Say you have code on lines 4, 5, 6. Then you want to move this block of code to starting point line 9 while also deleting lines 4, 5, 6. What's the fastest way, i.e. least amount of key strokes, to ...
8
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 ...
8
votes
2answers
357 views

How to overwrite a copied rectangle instead of inserting it (which is the default behavior of yank-rectangle)?

After copying a "rectangle" using C-x r M-w, doing C-x r y yanks or pastes the rectangle. But that inserts the copied rectangle. How can I paste the copied rectangle so that it overwrites the text? ...
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 ...
7
votes
3answers
534 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
1answer
372 views

Yank a column of text copied from the clipboard

I often seem to want to copy paste multiple columns, for example, I paste one column line one line two line three Now I'd like to be able to yank another column behind it. Assuming my kill buffer ...
7
votes
2answers
210 views

How to automatically adjust whitespace after yanks?

When editing human language text and moving text fragments around, I frequently run into the problem that whitespace moved at the beginning or end of a fragment doesn't fit into the new position. For ...
6
votes
3answers
356 views

Use avy to select distant word or line and paste at point

Is there a way to use avy or a similar in-buffer selection tool to quickly select a word or line to paste at the current point? For the following buffer an example workflow for proposed functionality ...
5
votes
1answer
3k views

Copy and paste to system clipboard in tmux

I have the following code in my init.el (xclip-mode +1) (setq x-select-enable-clipboard t x-select-enable-primary t x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) x-stretch-...
4
votes
3answers
637 views

Quickly open file by full path in clipboard

There is something that blocks my workflow quite often and I'm quite sure it's easy to solve. I sometimes copy file paths (e.g. /tmp/bar/foo.gz) from the command line into my host systems clipboard. ...
4
votes
2answers
186 views

Insert lines when yanking rectangle rather than inserting among following lines?

Having copied the 3x3 rectangular region containing a's, how can I yank/paste that content at the desired point without slicing into the following text? The following is the behavior for: M-w (kill-...
3
votes
2answers
209 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.
3
votes
1answer
133 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).
3
votes
1answer
485 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 ...
2
votes
1answer
75 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 ...
2
votes
1answer
37 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
1answer
167 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' ...
2
votes
3answers
129 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, ...
2
votes
3answers
1k 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
1answer
767 views

Copy and Paste From PDF to Emacs as Plain Text

Here is my problem: I often copy text from a PDF (let's say one that is nicely formatted or scanned cleanly) and like to post it in an active org-mode file I have for academic research. However, ...
2
votes
2answers
993 views

Is CUA Mode good over usual Emacs Cut and yank commands [closed]

Just wanted to capture the advantages of CUA mode over the usual emacs copy and paste commands. One advantage which is quite obvious is it similar to the keybindings which are present in other editors....
2
votes
1answer
125 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. ...
2
votes
2answers
105 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 ...
2
votes
1answer
190 views

How to yank text to search command (after “/”) in evil-mode?

Is it there any way to yank in the search command (after press "/") in evil-mode?
2
votes
1answer
63 views

Force append to buffer instead of at point

Is it possible to force an Emacs buffer to place any new text it receives at the end of the buffer, instead of at the mouse point? I mean all of: keystrokes, yanks, mouse paste. I'm thinking in ...
2
votes
1answer
140 views

Yank during yas-expand without aborting expansion

When expanding a yasnippet snippet and filling out completion fields yanking/pasting inserts text correctly among fields as expected, but interrupts the snippet expansion behavior (as if pressing C-g /...
2
votes
1answer
488 views

How do I disable the emacs flyspell middle mouse correction?

I already use middle mouse to paste/yank. However flyspell seems to hijack this, making it impossible to paste in the vicinity of a correctable word. With the help of this question I have discovered ...
2
votes
0answers
128 views

Prevent emacs to indent when yanking into html buffer

I have disabled electric indent mode, as specified here, but when yanking text, indenting is still performed. I am yanking text into an html buffer, and I do not want any change whatsoever to be ...
2
votes
0answers
312 views

Emacs/ESS/Org hangs/spins on yank

I have the following Emacs org buffer that I'm editing: #+BEGIN_SRC R regimes <- read.spreadsheet(wlda, 3) %>% within({ TurbineID <- paste(Site, Turbine) Date.of.Change....
2
votes
1answer
71 views

Function to paste killring after the current line (like “p” in vim)

I'm trying to write a very simple function to replicate the Vim 'p' command. This is, paste some text after the current line. I've been googling for a while and haven't found a function to achieve ...
2
votes
2answers
826 views

Evil mode pasting under line

I'm trying to achieve the following with this: $pricelist = pricelist(); $hotels[$index ]['id'] I want to copy the bottom line into the pricelist() function like this: $pricelist = pricelist($...
1
vote
5answers
86 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
3k 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
2answers
89 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?
1
vote
1answer
146 views

Yanking without moving the mark, but still be able to `yank-pop`

I would like to change C-y to not move the mark, but still be able to yank-pop. I looked at the source code and saw that the major change needed was to remove the (push-mark (point)) command: (defun ...
1
vote
1answer
25 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
1answer
26 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
2answers
40 views

Rotate the yanking ring

I have such a table | C | M | |---------------------+---------------------| | Character | Word | |---------------------+----------...
1
vote
1answer
71 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 ...
1
vote
3answers
71 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"]...
1
vote
1answer
175 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 ...
1
vote
1answer
151 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-...
0
votes
1answer
59 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 ...
0
votes
1answer
496 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?
0
votes
1answer
40 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
1answer
250 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 "...
0
votes
1answer
147 views

Yank from mouse in helm modes

For many built-in commands that require user input in the minibuffer I can yank from the middle mouse button (mouse-yank-primary with <down-mouse-2>). Some examples where this works are rgrep, ...
0
votes
1answer
100 views

How to interactivelly pass a `listp arg` to `yank`

Is it possible to interactively pass an argument that matches listp to the function yank so that current-kill receives an argument of 0? If so, how please can that be achieved? Background: I am ...