|
|
Up |
|
|
  |
Author: rock69rock69 Date: Jun 14, 2008 02:24
Is there some way to disable copying to the clipboard when deleting
something (ex. with M-d or C-k)? I'm asking this because I often find
myself copying something and then deleting successive lines, and when
I have to paste what I had previously copied, it's really annoying to
have to scroll through with C-y M-y.
|
| |
|
| | 6 Comments |
|
  |
Author: XahXah Date: Jun 14, 2008 02:54
On Jun 14, 2:24 am, rock69 gmail.com> wrote:
> Is there some way to disable copying to the clipboard when deleting
> something (ex. with M-d or C-k)? I'm asking this because I often find
> myself copying something and then deleting successive lines, and when
> I have to paste what I had previously copied, it's really annoying to
> have to scroll through with C-y M-y.
i doubt there's a buildin customization to let you set that pref.
You might need to write your own function to do delete text without
putting things in ring. (the elisp would be trivial... pls ask if you
want the code)
-------------------------
however, what you want is prob best done by using emacs's so-called
“register”, which basically allow you to have multiple clipborads.
select a region, then do M-x copy-to-register (C-x r x). Then type 1
(as the name of your register)
To paste that, type M-x insert-register (C-x r g), then type 1.
You can of course bind these to shortcuts with a simple elisp, so
that, for example, M-1 copy region to clipboard 1, M-S-1 paste it from
clipboard 1. Similar for 2, 3, etc.
|
| Show full article (1.93Kb) |
|
| | no comments |
|
  |
Author: rock69rock69 Date: Jun 14, 2008 03:18
On Jun 14, 11:54 am, Xah gmail.com> wrote:
> On Jun 14, 2:24 am, rock69 gmail.com> wrote:
>
>> Is there some way to disable copying to the clipboard when deleting
>> something (ex. with M-d or C-k)? I'm asking this because I often find
>> myself copying something and then deleting successive lines, and when
>> I have to paste what I had previously copied, it's really annoying to
>> have to scroll through with C-y M-y.
>
> i doubt there's a buildin customization to let you set that pref.
>
> You might need to write your own function to do delete text without
> putting things in ring. (the elisp would be trivial... pls ask if you
> want the code)
>
> -------------------------
>
> however, what you want is prob best done by using emacs's so-called
> “register”, which basically allow you to have multiple clipborads.
> ...
|
| Show full article (2.35Kb) |
| no comments |
|
  |
Author: XahXah Date: Jun 14, 2008 07:01
Here's a kill-word command that does not push text into kill-ring.
(defun my-kill-word (arg)
"Kill characters forward until encountering the end of a word.
With argument, do this that many times.
Do not push killed text to kill-ring"
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))
it's basically copy-paste of the same code of kill-word, execpt that
kill-region is replaced by delete-region.
here's a simple kill-line that doesn't push to kill-ring.
(defun delete-point-to-line-end ()
"Delete text from current position to end of line char."
(interactive)
(delete-region
(point)
(save-excursion (move-end-of-line 1) (point))
))
> Thanks again so much :)
you are very welcome. :) I got lots help here too.
|
| Show full article (1.17Kb) |
| no comments |
|
  |
Author: XahXah Date: Jun 15, 2008 04:27
i thought about the issue a bit. That is, about whether using kill
commands putting erased text into the kill-ring creates more efficient
work mode.
For this purpose, i wrote the equivalent non-kill versions and gonna
use it myself to experiment.
Here's the code, a bit more robust than in my previous post.
(defun my-delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument, do this that many times.
This command does not push erased text to kill-ring."
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))
(defun my-backward-delete-word (arg)
"Delete characters backward until encountering the beginning of a
word.
With argument, do this that many times.
This command does not push erased text to kill-ring."
(interactive "p")
(my-delete-word (- arg)))
|
| Show full article (5.37Kb) |
| no comments |
|
  |
Author: Steinar BangSteinar Bang Date: Jun 16, 2008 10:21
>>>>> rock69 gmail.com>:
> Is there some way to disable copying to the clipboard when deleting
> something (ex. with M-d or C-k)? I'm asking this because I often find
> myself copying something and then deleting successive lines, and when
> I have to paste what I had previously copied, it's really annoying to
> have to scroll through with C-y M-y.
The delete-region function might do the trick for you?
Either
M-x delete-region RET
or bind it to a key (ah,... it's actually on a menu! see below).
The result of `C-h f delete-region RET' :
delete-region is an interactive built-in function in `C source code'.
It is bound to .
(delete-region start end)
Delete the text between point and mark.
When called from a program, expects two arguments,
positions (integers or markers) specifying the stretch to be deleted.
[back]
|
| |
| no comments |
|
  |
|
|
  |
Author: XahXah Date: Jun 16, 2008 23:44
just a brief follow up on this thread in case others read this thread
in the future.
After 2 days, i've ended my experiment on using deleting word/line
shortcuts that doesn't push to the kill ring. My prelimary conclusion
is that it's not as convenient as emacs default way, of pushing any
deleted word/line into the kill-ring/clipboard.
My brief thinking is this... whether deleted text are pushed into the
clipboard is a more useful interface, depends on this:
• Whenever a user does a sequence of deletes of a word or line, is the
existing content in the clipboard useful?
Most of the time, the answer is no. Further, when deleting a line,
often it is useful that the deleted text be pushed into the clipboard
as to be immediately pasted somewhere.
my brief experience of using the non-kill version is that,
whenever i delete a line and needed to paste the deleted text
somewhere else, thet non-kill version forced me to increases keystroke
by 1 or 2. A rough guess on the frequency of deleting a line that
needs to be pasted elsewhere, is about maybe 1 out of 20 of every
delete word/line operation.
|
| Show full article (7.29Kb) |
| no comments |
|
RELATED THREADS |
  |
|
|
|