Questions tagged [copy-paste]

is about the editor operations cut, copy, and paste as they apply to Emacs. In Emacs, cut is called "kill" and paste is called "yank" (but Emacs enhances the standard cut and paste behavior).

Filter by
Sorted by
Tagged with
0 votes
1 answer
68 views

Use MacOS semantics for copy-paste

I use Emacs on MacOS, installed by homebrew: % ls -l /opt/homebrew/bin/emacs lrwxr-xr-x 1 kwilliams admin 44 Jan 31 2023 /opt/homebrew/bin/emacs@ -> /Applications/Emacs.app/Contents/MacOS/Emacs ...
Ken Williams's user avatar
1 vote
1 answer
58 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("...
uanr81's user avatar
  • 169
1 vote
2 answers
40 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 ...
Dan Drake's user avatar
  • 573
0 votes
0 answers
26 views

When running `term` in standalone emacs on OSX, how can I copy output?

This question maybe sounds a bit strange, but I can't for the life of me work out how to copy output from term when it is running in the standalone version ("standalone" as in when emacs ...
Fergie's user avatar
  • 193
0 votes
1 answer
56 views

Copy text at line N at point

How can I make a function that copies text from line number N at point? I will be at some specific line and point position and want to copy the text from a different line N.
Dilna's user avatar
  • 1
1 vote
3 answers
134 views

Using Emacs to find and copy relevant database records

I have reduced a large text file to a 1.9GB size that Microsoft Access can handle, but only as a linked file. To permit full Access operations - to import the relevant data into Access - I need to ...
Ray Woodcock's user avatar
1 vote
1 answer
277 views

Copy with Line Numbers

I have line-numbers displayed, but when I copy the text, the normal behavior is of course to not include the line numbers in the copied text. However, when I want to paste something on sites like this ...
Jason Hunter's user avatar
2 votes
2 answers
74 views

ctrl+backspace overwrites copy buffer

When I copy something first and then want to paste after I delete something, if I delete with CTRL+Backspace it pastes what I deleted when I CTRL+V (I can copy with CTRL+C and paste with CTRL+V in ...
efe373's user avatar
  • 19
2 votes
2 answers
406 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 ...
user avatar
0 votes
0 answers
77 views

(setq select-enable-primary t) breaks copy/paste in Emacs 28

After I updated Cygwin W32 to v28 selection of text started to copy the value to clipboard. I use selection to replace existing text with one from buffer but now the text is replaced with itself ...
gavenkoa's user avatar
  • 3,362
0 votes
1 answer
592 views

How can I copy the text to the clipboard while using spacemacs?

I know that on emacs I can install the xclip package in order to be able to copy text to the system clipboard... With the xclip package installed and adding the following to my .emacs file, I can copy ...
raylight's user avatar
  • 217
0 votes
0 answers
31 views

Org-capture: not able to copy paste image in transient buffer

Basically that: when I try to capture on the fly ideas with images, I can't paste them. Org-capture seems to only work for text. Any ideas on how to bypass this limitation? Thanks! I just noted this ...
Emmanuel Goldstein's user avatar
0 votes
1 answer
160 views

Org-mode: Copy headings only and yank to contents

I started from this post and now have code that already works for the following, for each level 2 heading: Add properties drawer :ANKI_NOTE_TYPE: Basic to the level 2 heading. Add two level 3 ...
WH Koh's user avatar
  • 3
0 votes
1 answer
239 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. ...
Pedro Delfino's user avatar
0 votes
1 answer
65 views

Copy Current Line

This code copies the current line: (defun copy-line () "Copy the whole line that point is ...
Jason Hunter's user avatar
8 votes
3 answers
5k views

Pasting images from clipboard into Orgmode

I have seen some posts on this but I decided to ask anyway since this is an important feature many users are requesting: the ability to copy an image from eg., Chrome and paste it into Emacs Orgmode ...
Emmanuel Goldstein's user avatar
0 votes
0 answers
54 views

What's the most efficient way to replace one string at one location with a certain string at another location

Quite often I encounter the situation where I need to insert a string from a certain location to some other location. I wanted to know your tips to get this as done as efficient as possible. My ...
Rareform's user avatar
  • 311
1 vote
1 answer
295 views

How can I use registers with Elisp?

It appears that all the documentation about registers revolves around C-x r [action] [char] or M-x [command] RET [char]. But let's say I want to create my own command using the register, how do I go ...
Alan's user avatar
  • 37
1 vote
1 answer
140 views

How to keep a multi-line nested bullet list indentation (and bullets if possible) when pasting from Google Docs to emacs

I copy a nested list like this: - foo - bar - foo - bar from Google Docs to emacs, but the bullet points vanish and the indentation as well. The same happens in the normal Linux text editor....
questionto42's user avatar
1 vote
0 answers
67 views

How to copy displayed ellipsis when buffer content is folded?

I have JSON files in which I am folding away some subnodes with the hideshow mode. This works reasonably well. Now I want to create a new file or buffer with the folded content. For example, my ...
halloleo's user avatar
  • 1,321
1 vote
0 answers
221 views

How can I copy out of emacs in terminal emulator with Wayland?

I often run Emacs in terminal emulator by emacs -nw. When using Wayland/Sway, how can I copy a text region out of Emacs to another window? When I use Ubuntu with X, I can do that by selecting the ...
Ben's user avatar
  • 11
0 votes
0 answers
349 views

Easiest way to copy an inline image from org mode to clipboard in Doom emacs

Easiest way to copy an inline image from org mode to clipboard. I tried ox-clip, but when hovering over the image i get: funcall-interactively: Symbol’s value as variable is void: org-html-inline-...
David's user avatar
  • 291
0 votes
0 answers
44 views

Pasting from vim to a buffer of emacs

I am rocking quite an idiosyncratic workflow that combines both vim and emacs in a tmux session, on an ssh server. The problem is, if I try to copy (y) something from a (neo)vim buffer and paste in an ...
Namudon'tdie's user avatar
3 votes
2 answers
275 views

Deleting words while preserving clipboard

Is there a way to keep the clipboard contents when deleting entire words with M-DEL? For instance, I'd like to delete a word (M-DEL) and then paste (C-y) what I had previously copied (with ctrl+c) ...
Ricky Robinson's user avatar
1 vote
1 answer
62 views

How do I cut and paste raw bytes in emacs?

Here are some raw bytes shown in emacs that are printing correctly: I can see that those are the actual bytes with od -bc on the command line: When I use control-space to mark, control-w to cut, and ...
dfrankow's user avatar
  • 111
1 vote
1 answer
418 views

Possible to copy-paste without markup in Org-mode?

You can add inline code and verbatim text in Org-mode using this syntax: ~<code>cd ~~</code>~ =verbatim /text/= This is expected to display: <code>cd ~</code> verbatim /text/...
lecodesportif's user avatar
0 votes
1 answer
77 views

quote copy/paste keys bindings

how can I copy a quote and paste it onto an emacs file? the shortcuts please?. I have tried to type the text but it is too long to write by hand.
user33994's user avatar
1 vote
1 answer
61 views

How can I prevent pasting after org-copy-visible leaving cursor at end of text?

In evil-mode, if I use 3yy to copy three lines, then move somewhere else in my file and do P (evil-paste-before), the three lines are pasted before the line with the cursor, and the cursor is left at ...
user2567544's user avatar
5 votes
1 answer
897 views

How can I copy+paste `org-mode` headlines only?

I have an org-mode file containing a structure like this: *** H1 **** H2 - Foo Foo **** H2 Foo Foo I would like to make a copy of H1 and all it's subheadings, but none of the non-headline content. ...
user2567544's user avatar
3 votes
1 answer
1k views

How to copy commit hash from Magit status buffer?

After I open a Magit status buffer and make a commit, I commonly also want to copy that commit's hash (the shortened version) to my clipboard to post somewhere else. I can't work out how this should ...
SLesslyTall's user avatar
1 vote
3 answers
254 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 ...
honestSalami's user avatar
0 votes
0 answers
467 views

Copy/Paste&Cut with Spacemacs on Terminal

I'm new with emacs, and I'm a developer that uses IDE to develop, and I want to learn emacs. I choose Spacemacs as customization because I think has a good keybinding for me, but now I miss a feature ...
vincenzopalazzo's user avatar
0 votes
0 answers
48 views

Why is a TAB character added when using kill-rectangle and yank-rectangle to insert multiple rows into an org-mode table?

I noticed an annoying behaviour when copying multiple rows (a list) from a web page into an org-mode table, following a process inspired by Is it possible to copy /paste multiple lines of text into ...
chr's user avatar
  • 77
2 votes
1 answer
199 views

Binding XF86Cut and XF86Copy to Emacs Commands

I have a keyboard with dedicated keys for XF86Cut, XF86Copy, XF86Paste. I want to bind these to Emacs commands. The goal is get the usual behavior for cut-and-paste between Emacs, my terminal, and my ...
Charles R's user avatar
  • 121
1 vote
2 answers
2k views

Remove everything except match of regexp?

I have a file with a structure like: some text and numbers and a final number: 1.213,31 some other number 1231 and text again some text and a final number: 53,00 something else again a final number: ...
student's user avatar
  • 1,007
0 votes
1 answer
185 views

Prompt for stdin via `shell-command`

Sometimes when I copy+paste into my spacemacs over SSH, I get some random garbage that seems to be due to spacemacs interpreting some of the pasted content as commands. In vim, my workaround is to run ...
Patrick Collins's user avatar
0 votes
1 answer
393 views

Cannot paste text copied from Emacs to synchronous subprocess

TL;DR When trying to paste text copied/killed in Emacs to another program while Emacs is waiting for a synchronous subprocess to finish, the target program hangs until Emacs becomes responsive again. ...
kdb's user avatar
  • 1,561
0 votes
1 answer
203 views

Paste into org-mode: utf-8-unix cannot encode \207 for á, \222 for í

I'm learning emacs (on spacemacs) and focusing on orgmode. When I paste into an org-mode buffer from a non-english language that contains accents and other signs (in my case italian and spanish) I get:...
L S's user avatar
  • 41
0 votes
1 answer
207 views

How to overwrite by pasting a string without selecting a region?

I can't figure out how to paste a string, for example 145 characters long, into a text line in a way, that the next 145 characters after the string are overwritten by this string or simply erased. An ...
starquake's user avatar
2 votes
2 answers
462 views

Function to copy the whole line if no region is selected

I want to bind this function to M-w, so that it copies the region if one is selected, otherwise it copies the whole line silently, without having any other side-effects like moving the cursor to some ...
Bite Bytes's user avatar
1 vote
1 answer
118 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 ...
dylanjm's user avatar
  • 313
1 vote
2 answers
414 views

How to copy the symbol name at point?

I want to copy the name of the symbol at point, without using the mouse. (global-set-key (kbd "C-s C-c") '<copy_word>) Possible word marking as i-search does on the following example usage (...
alper's user avatar
  • 1,300
3 votes
1 answer
278 views

Encrypt excerpts in org file (passwords only)

I keep project info in .org file together with passwords. When I share a screen it is annoying to show passwords in a buffer accidentally. I want to keep .org file in plain text format but mark some ...
gavenkoa's user avatar
  • 3,362
0 votes
0 answers
109 views

Pasting text into Emacs but preserving empty lines between paragraphs

When I copy text from another application and paste it into Emacs it removes all formatting including the empty lines between paragraphs. I would like to paste into Emacs and preserve the empty lines. ...
Edman's user avatar
  • 1,177
1 vote
1 answer
191 views

emacs -nw mode, when you paste in some text from another application emacs sometimes misses parts or stops halfway. how can I mitigate it?

In macOS in emacs -nw mode, when you paste in some text from another application emacs sometimes misses parts or stops halfway. Often I see a tilde as the last character entered, when there wasnt even ...
american-ninja-warrior's user avatar
1 vote
1 answer
244 views

Copy to PRIMARY selection in command

I'm a novice in Lisp, so I feel like I'm missing something very basic here. My intention was to create a function/shortcut to remove all whitespace and newline chars from the selected text and copy ...
knusprjg's user avatar
0 votes
0 answers
22 views

emacs breaks down text snippet copied from another X Window application

When I select with a mouse a block of text in Firefox or VIM for example, copy it and then try to paste in Emacs, it gets pasted, but unaligned, meaning that beginning of the lines shift away to the ...
Mark's user avatar
  • 165
1 vote
2 answers
1k views

Ctrl c Ctrl v copy paste in multi-term

I want to be able to copy paste using C-c and C-v when I edit a file and in multi-term. After more than a few hours I gave up. I would be thankful if anyone could tell me what the recommended way for ...
Volker Weißmann's user avatar
0 votes
0 answers
38 views

emacs in putty session on fedora under virtual box on windows 10 hangs on X11 paste

I suffer a rangy environment where I typically will run emacs in a putty session on fedora under virtual box on windows 10. Sometimes (not all of the time), pasting into the emacs will hang the ...
Nufosmatic's user avatar
5 votes
1 answer
1k views

Almost working smoothly attempt to get terminal Emacs to copy to clipboard

I'm running this emacs GNU Emacs 25.2.2 (x86_64-pc-linux-gnu) of 2017-09-22, modified by Debian directly in a Gnome terminal by calling emacs, which is actually a link to /etc/alternatives/emacs. ...
Craig  Hicks's user avatar