From: Tatsu Takamaro <tatsu.takamaro@gmail.com>
To: Drew Adams <drew.adams@oracle.com>,
"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: [External] : Q3 - how to delete by words, not cut?
Date: Thu, 19 Dec 2024 02:54:35 +0300 [thread overview]
Message-ID: <0484167b-e189-9d97-7513-355d1b3c96f1@gmail.com> (raw)
In-Reply-To: <DS7PR10MB52322FC5871071641A1C86C2F3042@DS7PR10MB5232.namprd10.prod.outlook.com>
*Did you try the `my-backward-delete-word' command I defined for you?*
Sorry, I didn't try it before. Because I didn't understand it by that
time (and I have a habbit not to run any code until I understand it good
enough). But now I dived into it and got it...
Though the function logic is clear, the key binding won't work. I tried
different keys. Here is the current state:
*(defun tt-delword-backward (arg)**
**"Delete backward arg words. (default 1)"**
**(interactive "C-;")**
** (let**
** ((opt (point)))**
** (backward-word arg)**
** (delete-region opt (point))**
** )**
**)**
**
**(defun tt-delword-forward (arg)**
**"Delete forward arg words. (default 1)"**
**(interactive "C-'")**
** (let**
** ((opt (point)))**
** (forward-word arg)**
** (delete-region opt (point))**
** )**
**)*
I tried to set (interactive "b") and (interactive "f") for backward and
forward respectively. When "C-;" is set the minibuffers says it's
undefined, when letters are set it just type letters. The call by M-x
doesn't do the job either.
вт, 17.12.2024 5:28, Drew Adams пишет:
>> 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.
next prev parent reply other threads:[~2024-12-18 23:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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-18 23:54 ` Tatsu Takamaro [this message]
2024-12-19 2:31 ` Drew Adams
2024-12-20 0:19 ` Tatsu Takamaro
2024-12-20 1:38 ` Drew Adams
2024-12-20 2:18 ` [External] : Q3 - how to delete by words, not cut? --- about Q4 - the bottom edge of Emacs doesn't stick to the taskba Tatsu Takamaro
2024-12-20 15:34 ` Drew Adams via Users list for the GNU Emacs text editor
2024-12-21 2:02 ` Tatsu Takamaro
2024-12-17 8:38 ` [External] : Q3 - how to delete by words, not cut? Vagn Johansen
2024-12-17 4:06 ` Jean Louis
2024-12-17 4:12 ` Drew Adams
2024-12-17 4:25 ` Jean Louis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0484167b-e189-9d97-7513-355d1b3c96f1@gmail.com \
--to=tatsu.takamaro@gmail.com \
--cc=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).