18
votes
Accepted
How to select and delete a column of text in emacs?
C-w kills the text between point and mark; it’s the normal command you would use to kill text. C-x r k kills the rectangle between point and mark. This is the one you want to use.
16
votes
How to select and delete a column of text in emacs?
If you select the rectangle, which in Emacs terms means make it an active rectangular region, then C-w does just what you expect.
Use C-x SPC to activate a rectangular region that you want to kill. ...
9
votes
Accepted
Delete from point to beginning of the line
There is C-0 C-k or C-u 0 C-k.
See section (info "(emacs) Killing by Lines").
6
votes
Accepted
How to transpose a pair of words?
Some observations first. When asking a question like that you must refer the mode, because the concept of a word depends on the major mode (lookup syntax tables in Elisp documentation). In this case, ...
5
votes
Kill URL at point
The url-get-url-at-point function from the url-util (emacs built-in) package should do the job for you. It is used in interactive commands like browse-url-at-point.
(require 'url-util)
(defun my/kill-...
5
votes
Accepted
copy region without leading indentation
You basically just want to be calling indent-rigidly on a copy of the region. That will also deal nicely with indent-tabs-mode (which I think you'll find your version does not).
I'd suggest using a ...
4
votes
Allow C-w to kill a region only if it is selected
I think you're looking for:
(setq mark-even-if-inactive nil)
4
votes
How can I move/kill multiple chunks of text to the same place/marker, one after another?
A basic option is to use append-next-kill.
Rather than killing each region with just C-w (or similar), you instead use C-M-wC-w (i.e. type C-M-w immediately prior to whichever kill command you're ...
3
votes
Accepted
How can I move/kill multiple chunks of text to the same place/marker, one after another?
I believe you're looking for org-refile (bound to C-c C-w). By default, org-refile will only consider the current file. To refile into another file add the target file with your desired headings to ...
3
votes
Kill rectangle with cua-mode support
CUA's help on rectangles (and other things) is slightly hidden away.
M-x find-library RET cua-base RET
Search the commentary for the section on "CUA rectangle support"
(Which is not to suggest that ...
3
votes
Accepted
What key sequence is killing a large chunk of my buffer?
It is possible that that you're calling kill-region which is bound to C-w. This is what one would consider the cut command in other applications. If the region is not active it will kill from your ...
2
votes
Accepted
Strange behavior when killling text in term/multi-term
This is not a bug. You can't use emacs commands in term-char-mode, you must toggle to term-line-mode for these commands...
But, you can use the terminal commands instead. For example C-w is the ...
2
votes
Kill and yank (append?) text from buffer to bottom of same buffer
I'd rather use standard keyboard short-cuts or the customised solution of @Taylor above, but for completenes sake here are two out of the box Emacs ways:
append-to-file: Save your buffer (so it's ...
2
votes
Accepted
Delete a line by relative line number
This simple function and keybinding to C-c d will ask you for a number and will delete line that number forward (or backward if you will use negative number):
(defun kill-line-relative (&optional ...
2
votes
Accepted
Yanking does not use top entry in the kill ring
I don't know why your kill-ring gets messed up. It might be that it is some inter-program action that modifies the kill-ring.
But the right way to implement deleting instead of killing is:
(defun ...
2
votes
copy region without leading indentation
Use rectangle commands:
C-x r M-w Save the text of the region-rectangle as the last killed rectangle (copy-rectangle-as-kill)
C-x r y Yank the last killed rectangle with its upper left corner at ...
1
vote
Mark up to and including the character under the cursor
In Emacs, the region is defined precisely (and only) as the stretch of text between point and the mark. The only way to achieve what you want is to position point where you want the region to extend ...
1
vote
Default yank keyboard shortcut does not work
I am using evil-mode also. Not sure if they interfere.
The entire purpose of evil is to make Emacs behave like vi/vim, and a very significant part of that emulation is the different key bindings, so ...
1
vote
How to limit mark/kill size of huge (org-mode) files?
It's not clear to me why Emacs hangs in what you describe, or what you mean by that.
But I think you're talking about accidentally defining a large region of text, and then killing or copying that, ...
1
vote
Delete from point to beginning of the line
I have C-<backspace> bound to the following function:
(defun phg/kill-to-bol ()
"Kill from point to beginning of line."
(interactive)
(kill-line 0))
Basically just the C-u 0 C-k from the ...
1
vote
1
vote
kill rectangle not working on Mac (missing file/library)
Comments on the question post made me understand that the rect library was missing. I looked into brew and tried a
brew upgrade emacs
and surprise surprise it told me that emacs was not installed,...
1
vote
Accepted
Command that does different things based on whether something is selected
To invoke a function, don't quote it: (kill-whole-line), not ('kill-whole-line).
You're looking for function use-region-p, so (use-region-p), not region-selected. (There is no predefined variable ...
1
vote
quickly kill and then yank parts of a program
If using evil you can move point to the d and type dt.
Another way I often do stuff like this in evil is move point to the d and then go in to visual state with v then move point to where I want (...
1
vote
Accepted
How to do paredit-kill backwards?
Since no one here has come up with an answer that is sufficient for my needs, I've continued with my aforementioned implementation which uses paredit-backward-delete under certain conditions. What I'...
1
vote
Accepted
Kill and yank (append?) text from buffer to bottom of same buffer
I don't think there's anything built-in that's more efficient than this:
select text
kill selection with C-w
move to end of buffer with M-> (i.e., end-of-buffer)
yank C-y
return to where I started ...
1
vote
Kill URL at point
This is the way to get a run of text with the same face under point:
(defun face-under-point ()
(interactive)
(let ((face (face-at-point t))
(start (point))
(end (point))
...
1
vote
Kill rectangle with cua-mode support
This one is pretty straightforward, M-k does it.
It is not listed in the mini-buffer help, and asking for help with C-? does not show more help.
It can be found on this link on rectangle editing with ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
kill-text × 25yank × 6
region × 4
key-bindings × 3
rectangle × 3
deletion × 3
org-mode × 2
text-editing × 2
motion × 2
indentation × 1
osx × 1
term × 1
help × 1
commands × 1
interactive × 1
mark × 1
kill-ring × 1
newlines × 1
paredit × 1
multi-term × 1
logging × 1
tooltip × 1
cua-mode × 1
delimiters × 1
large-files × 1