help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting a word using keybinding


From: Stephen Berman
Subject: Re: Deleting a word using keybinding
Date: Thu, 15 Oct 2020 13:34:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Thu, 15 Oct 2020 12:26:59 +0200 Christopher Dimech <dimech@gmx.com> 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)
>            )
>        )
>    )

Other have already shown how to correct your code, but here's some
advice with which you can maybe help yourself in future:

When I evaluate this code and then type `C-<tab>', I see this message:
"Invalid function: (backward-word)".  That tells you what the problem
is.  If you don't understand it, try reading the node "Run a Program" in
the Info manual "An Introduction to Programming in Emacs Lisp", which
you can access by putting the cursor after the closing parenthesis of
the following expression and typing `C-x C-e':

(info "(eintr) Run a Program")

In particular, this part of the node should help you see the problem
with your code:

  The single apostrophe, ‘'’, that I put in front of some of the
  example lists in preceding sections is called a “quote”; when it
  precedes a list, it tells Lisp to do nothing with the list, other than
  take it as it is written.  But if there is no quote preceding a list,
  the first item of the list is special: it is a command for the computer
  to obey.  (In Lisp, these commands are called _functions_.)  The list
  ‘(+ 2 2)’ shown above did not have a quote in front of it, so Lisp
  understands that the ‘+’ is an instruction to do something with the rest
  of the list: add the numbers that follow.

Steve Berman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]