unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: "Harald Jörg" <haj@posteo.de>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Deleting a word using keybinding
Date: Thu, 15 Oct 2020 18:44:11 +0200	[thread overview]
Message-ID: <trinity-4d17d1b9-ad8d-4a8b-a271-337f539d98f5-1602780251817@3c-app-mailcom-bs05> (raw)
In-Reply-To: <1f7ecd80-f927-20c6-b711-d383abe81ca2@posteo.de>

   Dear Haj, correct, if I happen toi be at the beginning of a word, it
   deletes the previous word.
   I would like to have it kill forward, so I modified as follows

   ( global-set-key (kbd "H-<delete>" )
       ( lambda () (interactive)
           (forward-word)
           (kill-word 1)
           (message "**** Killing a word")

       )
   )

   A small remaining part to to kill the whole word even if I am in the
   middle of a word,
   because my code only deletes from the current point onwards.

   Sent: Thursday, October 15, 2020 at 1:20 PM
   From: "Harald Jörg" <haj@posteo.de>
   To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs"
   <help-gnu-emacs@gnu.org>
   Subject: Re: Deleting a word using keybinding
   On 10/15/20 12:26 PM, Christopher Dimech wrote:
   >
   > I am trying to delete a word using keybinding string "C-<tab>" but
   the
   > Chord is still showing as undefined.
   >
   > I would like to delete a word even if I happen to be in the middle of
   > it., so I move backward.
   >
   > Here is the function
   >
   > ( global-set-key (kbd "C-<tab>" )
   > ( lambda () (interactive)
   > ( (backward-word)
   > (kill-word 1)
   > )
   > )
   > )
   If I get rid of one pair of parens, it works for me.
   ( global-set-key (kbd "C-<tab>" )
   ( lambda () (interactive)
   (backward-word)
   (kill-word 1)
   )
   )
   With the extra parens in your code, I get 'Invalid function:
   (backward-word)'. Maybe this is why you don't see any effect?
   Also note that if your point happens to be on the first character of a
   word, this function deletes the _previous_ word.
   --
   Cheers,
   haj


  reply	other threads:[~2020-10-15 16:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 10:26 Deleting a word using keybinding Christopher Dimech
2020-10-15 11:10 ` Jeremie Juste
2020-10-15 11:20 ` Harald Jörg
2020-10-15 16:44   ` Christopher Dimech [this message]
2020-10-15 18:44   ` Christopher Dimech
2020-10-15 20:25     ` Harald Jörg
2020-10-15 20:59       ` Christopher Dimech
2020-10-15 21:06         ` Thien-Thi Nguyen
2020-10-15 21:14           ` Christopher Dimech
2020-10-15 21:22             ` Christopher Dimech
2020-10-15 21:27               ` Drew Adams
2020-10-15 21:48                 ` Christopher Dimech
2020-10-15 21:24             ` Stephen Berman
2020-10-15 11:34 ` Stephen Berman
2020-10-15 13:48 ` Stefan Monnier

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=trinity-4d17d1b9-ad8d-4a8b-a271-337f539d98f5-1602780251817@3c-app-mailcom-bs05 \
    --to=dimech@gmx.com \
    --cc=haj@posteo.de \
    --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).