You can use kill-whole-line to kill the entire line point is on. Position of point does not matter. This command is bound to C-S-DEL by default.
You can also instruct kill-line (bound to C-k) to kill the entire line by setting the variable kill-whole-line to a non-nil value:
(setq kill-whole-line t)
Note that point has to be at the beginning of the line ...
Copy from Emacs to OS X clipboard:
select region then M-| pbcopy RET
Paste from OS X clipboard to Emacs:
C-u M-| pbpaste RET (replaces current region if it exists)
M-| runs shell-command-on-region, which as the name implies pipes the current region to a shell command. C-u M-| does the same thing, but replaces the current region with the ...
You need to customize save-interprogram-paste-before-kill to t. This will push your clipboard onto the killring in case you kill something in emacs before pasting the clipboard. A related customization is yank-pop-change-selection which pushes your current yank in emacs onto the clipboard. For both of these to work, you need x-select-enable-clipboard (...
There is no bug here. Since I was also annoyed with this behavior, I just read Evil code to find out why this is happening. So, here is a straight copy/paste of the well-commented one-liner from my Emacs configuration that fixes this issue:
;; Imagine the following scenario. One wants to paste some previously copied
;; (from application other than Emacs) ...
The solution I've found for myself is to use prefix arguments.
For me, killing half a line is a useful feature, but I want an easier
way of killing entire lines too. So I made it so that
murders everything in sight when given a prefix argument.
(defmacro bol-with-prefix (function)
"Define a new function which calls FUNCTION.
Except it ...
There's a package called whole-line-or-region which advises various built-in commands so that they act on the current line if no region is active, so M-w will copy the current line, and C-w will kill it, for example. I've been using the package for years, and find it indispensable.
Additionally, this package makes it so that a numeric prefix will indicate ...
is it feasible to make one?
Since this is emacs, yes.
My approach is to use a 3rd party tools that can take HTML and convert to plain text or even directly to Org format. I think this is an ugly hack, and there may be better ways to do this, but it looks like it works for my test cases.
(defun kdm/html2org-clipboard ()
"Convert clipboard contents from ...
(buffer-substring (line-beginning-position) (line-end-position))
As Tobias noted, this also copies properties of text. If you want to avoid that, you might want to go with buffer-substring-no-properties instead:
(buffer-substring-no-properties (line-beginning-position) (line-end-position))
This is not an answer for orthodox emacs. If, however, you're willing to blaspheme with evil's modal editing, you can:
dd for kill line
cc for copy line
Both can be prefixed by the number of lines to kill/copy (eg, 4cc will copy the next 4 lines).
If you use Emacs "the normal way" (i.e. as a GUI application), then it should already do that by default. If you use Emacs inside a terminal emulator, then indeed it doesn't know how to do that by default, but you can install the xclip package from GNU ELPA and then enable the xclip-mode which teaches Emacs how to do that both for GNU/Linux and for OSX.
You can't copy-paste between Emacs and a shell without using a system-wide copy-paste facility. Text terminals in general do not provide a copy-paste facility.
It seems that you're running this terminal Emacs in a terminal window in a window environment. Window environments do provide copy-paste; that's what happens when you use the mouse. However, this ...
Use function directory-files, for which C-h f tells you:
directory-files is a built-in function in `C source code'.
(directory-files DIRECTORY &optional FULL MATCH NOSORT)
Return a list of names of files in DIRECTORY.
There are three optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the ...
C-y does work, but you can also paste into the minibuffer from the default register using dotspacemacs-emacs-leader-key instead of dotspacemacs-leader-key: leaderre" or leaderrereturn.
Alternatively, you can search and paste the contents from any register: for example leaderre phrase you remember.
Personally, I've just set dotspacemacs-emacs-leader-key to ...
My crystal ball tells me you're using Emacs-24.5, which indeed had this limitation. This has been fixed in Emacs-25 where rectangle-mark-mode has been improved so you can move the cursor past the "end" of a line (and where you can use C-x C-x to go to another corner of the rectangle as well).
Sounds like you are being bitten by the fact that one command is bound to mouse-2, another command is bound to down-mouse-2, and the two commands do not play well together.
Do C-h k and then click mouse-2 on text (e.g. mistaake). The help should tell you what mouse-2 and down-mouse-2 are bound to.
If I'm right in my guess, you can try doing one of these ...
Simply use the kill ring. In evil, your simplest option is to use evil-paste-pop, bound by default to C-p. Here's the docstring:
Replace the just-yanked stretch of killed text with a different stretch.
This command is allowed only immediatly after a yank,
evil-paste-before, evil-paste-after or evil-paste-pop.
This command uses the same paste ...
If you just need this behavior for mouse selections, you can use the built-in setting mouse-drag-copy-region:
(setq mouse-drag-copy-region t)
If non-nil, copy to kill-ring upon mouse adjustments of the region.
The selection can be copied automatically if the OS supports primary selection by setting the below variable.
(setq x-select-enable-primary t)
From C-h v x-select-enable-primary, you get,
Non-nil means cutting and pasting uses the primary selection
The existence of a primary selection depends on the underlying GUI you use.
E.g. it doesn't exist ...
You can use the external utilities xsel or xclip (they have mostly the same features, I'll use xsel in this answer) to copy data from or to the X clipboard. To copy to the clipboard, pass the desired content on standard input. When pasting from the clipboard, the content is written to standard output.
To copy the selection to the X clipboard, use M-| xsel -...
1) How shall I avoid creating a text file with mixed encodings when copying its different parts from different sources into an editor such as emacs?
Irrespective of the source, you can always set the encoding of a buffer by setting the variable buffer-file-coding-system. An easy way to do this is via the keybinding C-x RET f which prompts you for a file ...
When I copy the text from the source to the emacs buffer ...
What you copy depends upon the application you are copying from. Some applications release UTF-8 encoded strings while others use different formats. Emacs uses the variable selection-coding-system to determine whether to decide the encoding from the data or presume a particular encoding. See the ...
Starting at the beginning of line 4 (ESC 4 ESC g g or M-4 M-g M-g to go there), C-3 C-k C-2 C-n C-y (or ESC 3 C-k down down C-y if you don't like holding modifiers down) will do this.
If you don't want to do the arithmetic in your head, but instead select lines visually, then
Move to the beginning of the zone to move
C-SPC to set the mark
Move down to the ...
I use the following for this:
(defun my-copy-simple (beg end)
"Save the current region to the kill ring after stripping extra whitespace and new lines"
(copy-region-as-kill beg end)
(while (looking-at "[ \t\n]")
The package https://github.com/Lindydancer/highlight2clipboard does exactly what you asked for. It use htmlize to create a HTML version of the text which it adds as an alternative paste text. (Note: This is a non-trivial operation which requires interfacing with the clipboard. This is operating system specific, currently OS X and MS-Windows are supported.)
As you have noticed, you can yank the password when Magit is reading
it in the minibuffer (this works pretty much always when user input is
read in the minibuffer for whatever purpose). So the sequence is more
P P RET
This might or might not cache the password, depending on various
settings. First you need to tell Git to cache the ...
These are just point and mark right after the yank command. Just see the doc for yank or yank-pop. If you want to conserve these positions you could advice yank. Make sure that you save these values as markers or in buffer-local variables!
One more thing: If you want to see these values just once you can call M-: (mark) and M-: (point) right after the yank ...
Actually for org-table-copy-region it isn't necessary to mark the exact column width! Just mark the beginning of the column somewhere in a cell, then the end by going down the required number of rows and do C-c C-x M-w (for M-x o-t-c-r).
Then go to another cell, where you want to add the column and do C-c C-x C-y (for M-x org-table-paste-rectangle).