From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Harald_J=c3=b6rg?= Newsgroups: gmane.emacs.help Subject: Re: Deleting a word using keybinding Date: Thu, 15 Oct 2020 13:20:17 +0200 Message-ID: <1f7ecd80-f927-20c6-b711-d383abe81ca2@posteo.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21311"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 To: Christopher Dimech , Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 15 13:21:07 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 1kT1Jj-0005Sv-Fv for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 13:21:07 +0200 Original-Received: from localhost ([::1]:55734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT1Ji-0007PZ-G9 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 07:21:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT1JA-0007MQ-Vf for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 07:20:34 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:43301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT1J3-00079B-Ne for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 07:20:32 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 71FB12400FB for ; Thu, 15 Oct 2020 13:20:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1602760818; bh=I/LUb2910BfZui3yZBXWVBuCkH2S8o1g+AWSaCoP5/Y=; h=Subject:To:From:Date:From; b=PCF9xRk1gDG9T4nHO/dV5BlCI0vmw6ViywQfq6anBMZ/fr7b018GKm0/fPFe9886R vs45QvryJ0ePcVQVbPP/XtQueP8+5uxBtir0IgWQaPJniqLfplXVhDv0KwlCZMnZ9y r3H1IKKQweeRTPtBKyfW8X/bjn1PnKuQmpGLiQI1vzpag2VvQB7p4BsThiAdNFqduh jMXL31cL+2IDKL+SR1A3gIHAFUbd1UgjcjR55dqgakwKb/DyalTP7asO0KhYyoN8e6 LceypSJ37ux8AqZAmxddJLSS6RTTqZWMD4IKYj1ys+RF8mwa5sFRaxgxN+PgvQ9dZV huhhzZi4OAe0Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CBmzP6L7Fz6tmK; Thu, 15 Oct 2020 13:20:17 +0200 (CEST) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=haj@posteo.de; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 07:20:18 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 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, NICE_REPLY_A=-1.019, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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:124465 Archived-At: On 10/15/20 12:26 PM, Christopher Dimech wrote: > > 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) > ) > ) > ) If I get rid of one pair of parens, it works for me. ( global-set-key (kbd "C-" ) ( 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