From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Deleting a word using keybinding Date: Thu, 15 Oct 2020 18:44:11 +0200 Message-ID: References: <1f7ecd80-f927-20c6-b711-d383abe81ca2@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22808"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: =?UTF-8?Q?Harald_J=C3=B6rg?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 15 18:48:01 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 1kT6Q5-0005ow-Je for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 18:48:01 +0200 Original-Received: from localhost ([::1]:45856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT6Q2-00041Q-MT for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Oct 2020 12:47:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT6MS-00041C-JC for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 12:44:16 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:36033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT6MQ-0000Mw-Ff for help-gnu-emacs@gnu.org; Thu, 15 Oct 2020 12:44:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602780251; bh=+LDCPwMfpmYa24ngs/qH6MBU3QwVe8ZPmFHIElU0f7s=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=GLGiwpdO/by3QA46wjTpJ60eRI0kA42B58tbTeUZl3R7QqLOX/hS7WaUzzkdA1YX/ 9fjrzczDQ+YjIXZQDoE9RGGKO6rShXiLdfeul5MTaAcE+DrBrFPjhRrStpaZSZz5AF bHnSxhpJWgmdKECJCdqRkWmbK7JBVdpEqnSjCWU0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs05.server.lan [172.19.170.173]) (via HTTP); Thu, 15 Oct 2020 18:44:11 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <1f7ecd80-f927-20c6-b711-d383abe81ca2@posteo.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Cf1iiL5hioYj7fTp2qivW22V29irVOr5y/ByfCWU9IckqCs+NjnkHyxaIpX1kuwnHmKBw J0+9hfVFf9KJkcql388TeKutq+6jUnxFos9LpKtYBreZblFB9jTlqjkAt/u4wKd9C95vDqGkzOHw qiKsj1SXJq7f88nBwPusWr26P4ZYR3B9sJpAMXriM4ZyMERE1aztvB3kpkIMfolbxHcsT5fKMKYN sglp8mfRsfzmXLGbA6H/hBxoGL4sC8PgyMSZVVYrX7v8s5LEaKU9oWFJ3J2wMyRLo9FXo5OtPJ2S aQ= X-UI-Out-Filterresults: notjunk:1;V03:K0:ASa9AOIccMM=:jebRUarg9jl6M6lV4GYMtd sH/MNIiDISQsbZ+8RDL4Zr1cgPkx/ZQgzpP5r+CWof3uM99YrN7CXOSo+POnkA6k4iIAmaFJV 2VqSFYuKKUpnO3rtpXLxbQmu1dGe+O/qCoTaVZb3hEq2n6aYujRxZIzkIx55lUjIs/Uf86QOK 4HDZ8EGmUWzn8w2qtQcTEUtpoFeFI7B64yJq6y6jfubh4B4fuWNgPW+CIpFMcj6isAqof8jjH aCXuNKs6HbXlwUr8IgP3BWYnqPJWLvytnkpFKAwVCWbHin3GARcN9pN0lVvx8cbUG+OliMC3z F4pkIK/hxcAUGyb56pBP9j1FduOu7MfgijQ93RfePHy3xozYdFVnV/0b+qDlCSmkqMki07bUQ 2rLkZ5lkY9HrWlkrfYdHM/3bVpCGwRKQz3bvKJwh3sGLcAl0tgBAXp38QVPtIGZDpto09C/1R vI3gBn9Kc62eWw7HiyMM80o2aldBeuCR7eljtq+NYe3C73m03BWf9L6UxBVh1Z6Gjr4QDIcLu fYoiG/D58b2vGQz6rz6Ru1XFUy+q3xsLIds+enEQVw1gR6JyNc34fKjTlAWsEVqTLvtFLBbUT 0ns2wGeA0aQzo= Received-SPF: pass client-ip=212.227.17.21; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 12:44:12 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, 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-Content-Filtered-By: Mailman/MimeDel 2.1.23 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:124469 Archived-At: 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-" ) ( 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" To: "Christopher Dimech" , "Help Gnu Emacs" 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-" 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