* Q3 - how to delete by words, not cut?
@ 2024-12-14 23:57 Tatsu Takamaro
2024-12-15 2:42 ` [External] : " Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Tatsu Takamaro @ 2024-12-14 23:57 UTC (permalink / raw)
To: help-gnu-emacs
Question 3 of 4.
What if I want not to cut (or how you call it - kill) a word with
"backward-kill-word" and "kill-word", but delete it (so as not to put
the words into the exchange buffer (clipboard))?
Tony.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [External] : Q3 - how to delete by words, not cut?
2024-12-14 23:57 Q3 - how to delete by words, not cut? Tatsu Takamaro
@ 2024-12-15 2:42 ` Drew Adams
2024-12-15 2:45 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2024-12-15 2:42 UTC (permalink / raw)
To: Tatsu Takamaro, help-gnu-emacs@gnu.org
> What if I want not to cut (or how you call it - kill) a word with
> "backward-kill-word" and "kill-word", but delete it (so as not to put
> the words into the exchange buffer (clipboard))?
^^^^^^^^^^^^^^^
^
kill buffer
Something like this:
(defun my-backward-delete-word (arg)
"Delete backard ARG words.
ARG is the numeric prefix arg (default 1)."
(interactive "p")
(let ((opt (point)))
(backward-word arg)
(delete-region opt (point))))
Bind it to some key.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [External] : Q3 - how to delete by words, not cut?
2024-12-15 2:42 ` [External] : " Drew Adams
@ 2024-12-15 2:45 ` Drew Adams
2024-12-16 23:26 ` Tatsu Takamaro
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2024-12-15 2:45 UTC (permalink / raw)
To: Drew Adams, Tatsu Takamaro, help-gnu-emacs@gnu.org
See also (elisp) `Deletion':
https://www.gnu.org/software/emacs/manual/html_node/elisp/Deletion.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [External] : Q3 - how to delete by words, not cut?
2024-12-15 2:45 ` Drew Adams
@ 2024-12-16 23:26 ` Tatsu Takamaro
2024-12-17 0:01 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Tatsu Takamaro @ 2024-12-16 23:26 UTC (permalink / raw)
To: Drew Adams, help-gnu-emacs@gnu.org
Unfortunately, as it was said by others, there is no built-in function
to delete by word.
вс, 15.12.2024 5:45, Drew Adams пишет:
> See also (elisp) `Deletion':
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Deletion.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [External] : Q3 - how to delete by words, not cut?
2024-12-16 23:26 ` Tatsu Takamaro
@ 2024-12-17 0:01 ` Drew Adams
2024-12-17 0:26 ` Tatsu Takamaro
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2024-12-17 0:01 UTC (permalink / raw)
To: Tatsu Takamaro, help-gnu-emacs@gnu.org
> Unfortunately, as it was said by others, there is no
> built-in function to delete by word.
Do you need one? What's wrong with the non-built-in
one I gave you?
This might give you a hint: Most Emacs users haven't
felt the need for one to be built-in. Emacs is > 40
years old. It's had thousands, probably millions, of
users. And users don't hesitate to request things
they find missing. You can bet that if it were felt
important that such a function be built-in, it would be.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [External] : Q3 - how to delete by words, not cut?
2024-12-17 0:01 ` Drew Adams
@ 2024-12-17 0:26 ` Tatsu Takamaro
2024-12-17 2:28 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Tatsu Takamaro @ 2024-12-17 0:26 UTC (permalink / raw)
To: Drew Adams, help-gnu-emacs@gnu.org
Well, if I often work with a buffer (I mean a clipboard, not a Emacs's
buffer), I often paste from it. And with "cut" functions instead of
"delete" I will have my clipboard full of trash instead of some useful
text paragraph. Of course, it's not very important.
I assume I would do it by a cycle - delete one char per each iteration
until the char is a space. But I don't know Elisp, so I'm not sure (for
now) how to make this cycle and how to bind a cycle (not a single
command) on a key. So, maybe later. Or maybe someone would help here.
вт, 17.12.2024 3:01, Drew Adams пишет:
>> Unfortunately, as it was said by others, there is no
>> built-in function to delete by word.
> Do you need one? What's wrong with the non-built-in
> one I gave you?
>
> This might give you a hint: Most Emacs users haven't
> felt the need for one to be built-in. Emacs is > 40
> years old. It's had thousands, probably millions, of
> users. And users don't hesitate to request things
> they find missing. You can bet that if it were felt
> important that such a function be built-in, it would be.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [External] : Q3 - how to delete by words, not cut?
2024-12-17 0:26 ` Tatsu Takamaro
@ 2024-12-17 2:28 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2024-12-17 2:28 UTC (permalink / raw)
To: Tatsu Takamaro, help-gnu-emacs@gnu.org
> I assume I would do it by a cycle - delete one char per
> each iteration until the char is a space.
Do what? Delete a word backwards? Did you try the
`my-backward-delete-word' command I defined for you?
> But I don't know Elisp...
Time to learn a little, if you want to define your
own commands. I recommend you look into the Intro
Elisp manual: `C-h i m intro TAB RET'.
The command I defined saves the current cursor
location (point); then it uses predefined function
`backward-word', to move backward a word; then it
uses predefined function `delete-region', to delete
the text between the new location (point) and the
original (saved) location.
If you want to define deletion (not kill) commands,
then use `delete-region' (or other deletion functions).
They're building-block functions, not commands.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-17 2:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-14 23:57 Q3 - how to delete by words, not cut? Tatsu Takamaro
2024-12-15 2:42 ` [External] : " Drew Adams
2024-12-15 2:45 ` Drew Adams
2024-12-16 23:26 ` Tatsu Takamaro
2024-12-17 0:01 ` Drew Adams
2024-12-17 0:26 ` Tatsu Takamaro
2024-12-17 2:28 ` Drew Adams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).