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.
(defun my/kill-url-at-point ()
"Kill the url at point."
If you need to copy URL from an HTML page while in an emacs ...
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 temporary buffer, and maintaining the original values for indent-tabs-mode and tab-width.
Something like this:
(defun my-copy-region-unindented (pad beginning ...
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 point to where the last mark was, which could possibly be the beginning of the buffer.
The command view-lossage (bound to C-h l or <f1> l) displays the last ...
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 library commentaries in general are "hidden" -- they're a crucial aspect of Emacs' documentation which all users should know how to access. It's just that in ...
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 terminal backward-kill-word. fortunately, a lot of commands have (almost) the same behavior in terminal and in emacs (C-k, M-c, M-l, M-. ...).
Another problem is ...
As @wvxvw and @Drew implied in the comments, I too believe that kill-sexp (bound by default to C-M-k) is a more appropriate command to use than kill-whole-line for the use cases in your examples.
For your first example, I would either use
C-M-k followed by C-k (to delete the empty line), or
kill-whole-line (bound to a convenient key if I use it too often)...
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 only working for buffers with an underlying file) and select a region, then M-x a-t-f and specifying your-file will ad the region is at the end of your-file. (To ...
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 point (yank-rectangle)
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 delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument ARG, do this that many times."
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 arg)
"Kill relative line."
(global-set-key (kbd "C-c d") 'kill-...
I have C-<backspace> bound to the following function:
(defun phg/kill-to-bol ()
"Kill from point to beginning of line."
Basically just the C-u 0 C-k from the other answer, see kill-line.
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 (usually using ace-jump) and then type x
Some advantages of the 2nd way are:
You don't have to bother thinking of just the right character to put after the dt of ...
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, so it seems that my emacs was a default "build in" prior to me switching to use homebrew and my global brew upgrade command had not actually upgraded emacs ...
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 region-selected.)
You need to pass functions the arguments they require. So (kill-region (region-beginning) (region-end).
If you want it to be a function then ...
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've come up with isn't very pretty (nor very efficient), but it works well enough and seems to keep true to the spirit of paredit from an end-user perspective. ...
I don't think there's anything built-in that's more efficient than this:
kill selection with C-w
move to end of buffer with M-> (i.e., end-of-buffer)
return to where I started with C-u <space> <space>
If you do this a lot, you can wrap these operations into a function:
(defun my-yank-at-end (beg end)
This is the way to get a run of text with the same face under point:
(defun face-under-point ()
(let ((face (face-at-point t))
(cl-loop while (eql face
(or (get-char-property start 'read-face-name)
(get-char-property start '...
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 cua mode.
Interestingly, I can not find those comments on current cua-rect.el code.
But it is there: (cua--rect-M/H-key ?k 'cua-cut-rectangle-as-text).