* 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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
2024-12-17 4:06 ` Jean Louis
0 siblings, 2 replies; 11+ 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] 11+ 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
2024-12-17 4:06 ` Jean Louis
1 sibling, 1 reply; 11+ 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] 11+ 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
2024-12-17 8:38 ` Vagn Johansen
0 siblings, 2 replies; 11+ 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] 11+ 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
2024-12-17 8:38 ` Vagn Johansen
1 sibling, 0 replies; 11+ 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] 11+ 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 4:06 ` Jean Louis
2024-12-17 4:12 ` Drew Adams
1 sibling, 1 reply; 11+ messages in thread
From: Jean Louis @ 2024-12-17 4:06 UTC (permalink / raw)
To: Tatsu Takamaro; +Cc: Drew Adams, help-gnu-emacs@gnu.org
* Tatsu Takamaro <tatsu.takamaro@gmail.com> [2024-12-17 02:28]:
> Unfortunately, as it was said by others, there is no built-in function to
> delete by word.
I use M-d to delete by word.
--
Jean Louis
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [External] : Q3 - how to delete by words, not cut?
2024-12-17 4:06 ` Jean Louis
@ 2024-12-17 4:12 ` Drew Adams
2024-12-17 4:25 ` Jean Louis
0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2024-12-17 4:12 UTC (permalink / raw)
To: Jean Louis, Tatsu Takamaro; +Cc: help-gnu-emacs@gnu.org
> > Unfortunately, as it was said by others, there is no built-in function
> > to delete by word.
>
> I use M-d to delete by word.
The default binding of `M-d' is `kill-word'.
TT wants to delete words without adding them
to the kill-ring. And backward (like
`backard-kill-word', without killing).
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [External] : Q3 - how to delete by words, not cut?
2024-12-17 4:12 ` Drew Adams
@ 2024-12-17 4:25 ` Jean Louis
0 siblings, 0 replies; 11+ messages in thread
From: Jean Louis @ 2024-12-17 4:25 UTC (permalink / raw)
To: Drew Adams; +Cc: Tatsu Takamaro, help-gnu-emacs@gnu.org
* Drew Adams <drew.adams@oracle.com> [2024-12-17 07:12]:
> > > Unfortunately, as it was said by others, there is no built-in function
> > > to delete by word.
> >
> > I use M-d to delete by word.
>
> The default binding of `M-d' is `kill-word'.
> TT wants to delete words without adding them
> to the kill-ring. And backward (like
> `backard-kill-word', without killing).
M-Backspace deletes word backword.
What one can do to avoid kill ring is to set variable `kill-ring-max'
to zero with {M-x customize-option RET kill-ring-max} and then it will
not be saved in the kill ring. That is not accurate result for the
wish though. Undo works well, but kill ring becomes empty.
--
Jean Louis
^ permalink raw reply [flat|nested] 11+ 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
@ 2024-12-17 8:38 ` Vagn Johansen
1 sibling, 0 replies; 11+ messages in thread
From: Vagn Johansen @ 2024-12-17 8:38 UTC (permalink / raw)
To: help-gnu-emacs
Tatsu Takamaro <tatsu.takamaro@gmail.com> writes:
> 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.
People then press M-y (yank-pop) to go to next "saved" item
--
Vagn Johansen
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-12-17 8:38 UTC | newest]
Thread overview: 11+ 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
2024-12-17 8:38 ` Vagn Johansen
2024-12-17 4:06 ` Jean Louis
2024-12-17 4:12 ` Drew Adams
2024-12-17 4:25 ` Jean Louis
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).