From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Deleting a word using keybinding Date: Thu, 15 Oct 2020 13:34:33 +0200 Message-ID: <877drrrad2.fsf@gmx.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13334"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Help Gnu Emacs To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 15 13:36:36 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kT1Yh-0003Mq-2I for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 13:36:35 +0200 Original-Received: from localhost ([::1]:40684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT1Yf-0005kJ-V4 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 07:36:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT1Wr-0005iw-Lw for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 07:34:41 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:50105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT1Wp-0000rD-Fu for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 07:34:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602761677; bh=vOIHAb03fpMo8F9cQ7uKpvoJ+gF5a6sQVL57mdDLuBc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=l51a6Z5e7QE0VqgmUwH5hax6f36+evKI3pxMJrC558SRYFxrEFpwPGhIwHRHIn4PX aUWHvZKWl54XvrL5LwKrqVW4JEN8Ll3XBeix7c31mCIkeYNUEuS4Q4IMyWL2Zo/0iK /kK3tsy1X6sKxxdNKdKI0qrH9KoiWF4PIMgCLMi0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([178.1.122.151]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MMXUN-1kmcJP47gV-00JWWV; Thu, 15 Oct 2020 13:34:37 +0200 In-Reply-To: (Christopher Dimech's message of "Thu, 15 Oct 2020 12:26:59 +0200") X-Provags-ID: V03:K1:XHZyoyMGys+xzsibRsRQafihWIQox8iqj5vqx12D3huZg/8PX7x zw+2RKuHwVAylxsACndQb45D9O3ZROJBCxXJG4KYMvq1jXigsgoRR2Tstr/QvD2vElRSXaT fNR8f0S454ouzumD38dO91euIB1o7Hd/6HSXHkTxTiqa3VkKqWfHzdpbmeVqE+ItcyHv1mH Gc5KozfRDT+JXTGyXuzlQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:eSMa+3DX7Gk=:LHQ2PuDWbzV3Tx2SPNwLlS ujuBU62IKlkHowv5udeIy0PDVUcUPOBn+wdILjt5hEQNLCoBncXaNiZPecWJZP/BIt9SXQJvk efjPDpaoIT5sfb4KbfJ/yBwSu70LMUs0Ug5FOyDpFuuDXzBBMw22oc88+oBaUzhwzgG9npfuf DCCTjzXa9TSmW33rD6BE7/OdupG86itpF0lptqcycbEstS5UNA5C3LK0zPM171FsHW/2zGSK2 7j7CVmnyrliLt7WmYE9SOVbOs0VpCpq+adMTXttHtztRWBN0FIdehiu/pNGZqIx5Fw4h7tV9W 7K7tw9M1vIfYx8GSkmzMmjCEAtBKHDXIyYp16OE/y0rTTD2f1zJQpYKG3eEFKpRTpc6aAFMc5 E7fvLJVVYT8TKDJ33WF0VMs1i947YjcSA8lwT+QwIi7UfPfAiqbNGr95FB6niFKdfddMVRhuC D1lz+rgywiLPoqQJM/kyM1TQkyW4FKWDoRd85hkH0t3BJfyz1DINhhLKYtRRyWCq9f1C1jyFh 5EiWJE1tColJGIb3AtlJmQ/34PQsxUQ0iwM1LhOR7zOQZeuNN0qZd5W6Wi3E++bUyfu05/h1/ xFtNSzpMqBwk2NSK+MRopF9ajBMfxYxNgVKhhOE6UQ9m7oQmmDNA3rByNbkC2uYzty67IYVTt qLjJLQYUCTKCz6j5HaAzG6g+0Z6J3IGtqvuaq7E6/dr+gg9TQB/8ursyPiwsY26Si1ULxkbiM ZZ5lFzq59Grq7mc+ExHMomiFS2NRD4dwCRUww45v+UGdcuXtptalfA/x+yyool5yojlsi5xc Received-SPF: pass client-ip=212.227.17.22; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 07:34:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124466 Archived-At: On Thu, 15 Oct 2020 12:26:59 +0200 Christopher Dimech wrot= e: > I am trying to delete a word using keybinding string "C-" 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-" ) > ( 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-', 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, =E2=80=98'=E2=80=99, that I put in front of some o= f the example lists in preceding sections is called a =E2=80=9Cquote=E2=80=9D; = 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 =E2=80=98(+ 2 2)=E2=80=99 shown above did not have a quote in front of it= , so Lisp understands that the =E2=80=98+=E2=80=99 is an instruction to do somethin= g with the rest of the list: add the numbers that follow. Steve Berman