From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tatsu Takamaro Newsgroups: gmane.emacs.help Subject: Re: [External] : Q3 - how to delete by words, not cut? Date: Thu, 19 Dec 2024 02:54:35 +0300 Message-ID: <0484167b-e189-9d97-7513-355d1b3c96f1@gmail.com> References: <53671653-5c61-334b-c638-c70bdada6cd5@gmail.com> <45329ea1-7976-9dae-120f-3ddb23384a45@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39538"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 To: Drew Adams , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 19 00:55:21 2024 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 1tO3su-000ACk-Sd for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 19 Dec 2024 00:55:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO3sN-0002vw-2x; Wed, 18 Dec 2024 18:54:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO3sH-0002vh-De for help-gnu-emacs@gnu.org; Wed, 18 Dec 2024 18:54:41 -0500 Original-Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO3sF-0007nG-MJ for help-gnu-emacs@gnu.org; Wed, 18 Dec 2024 18:54:41 -0500 Original-Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4362f61757fso1975305e9.2 for ; Wed, 18 Dec 2024 15:54:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734566078; x=1735170878; darn=gnu.org; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Krzl4HT4K60+k76yz4Hy4jCmOxuftFU8p2uvqQNcHzg=; b=OdNv4BlNwiu6N8FoL0eQjxF1JhYJxiK+j6CwhUJ75rcN6NlVj4JWQ21mHkYMXp5mge k1Tn+EcJNwFfrXsNS0NyLaAmYzzXqI4KcCJ/S5rX/atA+0cilxV0fJTGPb89oeKKqVwM 3v5UhdktGJAqjVgZ/mVy4t7VWyBkJud/9tEQB0yYPnDzSExXspk+gmjJuE47DsdT6QjT R4HeRm38NPQ843wXjdmMkT8QPILVj7j3NZtnP9kzl+PmrP9mPyzqucNHZX2JvQGz1aak lirYVo21wMREOTj0TIsQQ5ZmsNN/yh1xgTy3Mar3RC1ESY0+D190q1pLISczHvHRJSSA pVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734566078; x=1735170878; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Krzl4HT4K60+k76yz4Hy4jCmOxuftFU8p2uvqQNcHzg=; b=RzOcI/r8LkihH4LWt3LvtIilb4pPoyA5yT3thW2kQSkTeGT2iZaZl0xWLeHAyh+elb nwjrJDmgUCQEhy+XOqQQJZJCTr0upH93Dg5js5HnXEvkHddXEZcpMv2HqabwP71B/ztr 4bPYLETSYa6Ay3aXWVCHK+3CwJVkIwhRRncU/mY0pT0vbHYetQ2uSl5/RdskaFRjkEwn 2+L957s3HrWh0N6XizeQ6hic8l7SSF10gTmaxlufS8cV7YQ3hlcNrHJMU27V61VRxRFf EtLqG7m9XvoBqV/S72MfYlJXYEtIjKUNqEu35CjS1swZGZUQz9kpDtbYbzrMOke/0FJx yFSA== X-Forwarded-Encrypted: i=1; AJvYcCXrXh38tFz8JypSJ5QMmDcdcKxVASMPHNI3QlRNVjJTsdnmjZ0I5/8REqku0aVrkEmKcvL7yQquge9odPi2Fg==@gnu.org X-Gm-Message-State: AOJu0YweZO408WQ2WTYox7uz9Yy3WFk4BACAEPCjzLfGcchwt6XdZoix IRxccwW0iLJ3mk26EdYVmGTLF3Ng6Nd4NknQBDWjRyFluCa8UOZU X-Gm-Gg: ASbGncuZWkRqbwx7YVq7ec76a5dr9vzbtLMDDxB8+aI8q/5JWZyFCSRBzDhKV1vU0/1 ZRZLXXbN0LV5MDRWqZ6tk8uVmkyRuzTy43d950XlsuloodjzrInPruOs1Sxv6KFZPkwSUo/ew6g HibFVNFOvj7J8T34hrxebvL1Xf1WWaZFifJ4obhLYAilVxtVhDdsgHGRTk42gpoa6Z76dLMqevY ApsnidKtxZsoJl3fcBROxrev3MRKp5S7H/f1PaPRd40xdjVKqM9Id4Qx/37Dv5a0C2bMzk/SXp3 /EZqZFTCerf78IBuScjEF6SCpNPdB7JFGhuww1v3kzgENvoStO+l X-Google-Smtp-Source: AGHT+IFlIYnp6B2XUI+YwrUA5V5rfgJjMVSzXldB+Gd/ostPUAnMsYBmN/dSjyYynnlZoq+UPrThxA== X-Received: by 2002:a05:600c:350c:b0:435:d22:9c9e with SMTP id 5b1f17b1804b1-4365536be84mr40400455e9.19.1734566077444; Wed, 18 Dec 2024 15:54:37 -0800 (PST) Original-Received: from [192.168.1.120] (broadband-37-110-24-126.ip.moscow.rt.ru. [37.110.24.126]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436611ea387sm352395e9.6.2024.12.18.15.54.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Dec 2024 15:54:37 -0800 (PST) Content-Language: ru In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=tatsu.takamaro@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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, HTML_MESSAGE=0.001, NICE_REPLY_A=-2.107, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148879 Archived-At: *Did you try the `my-backward-delete-word' command I defined for you?* Sorry, I didn't try it before. Because I didn't understand it by that time (and I have a habbit not to run any code until I understand it good enough). But now I dived into it and got it... Though the function logic is clear, the key binding won't work. I tried different keys. Here is the current state: *(defun tt-delword-backward (arg)** **"Delete backward arg words. (default 1)"** **(interactive "C-;")** **  (let** **  ((opt  (point)))** **  (backward-word arg)** **  (delete-region opt (point))** **  )** **)** ** **(defun tt-delword-forward (arg)** **"Delete forward arg words. (default 1)"** **(interactive "C-'")** **  (let** **  ((opt  (point)))** **  (forward-word arg)** **  (delete-region opt (point))** **  )** **)* I tried to set (interactive "b") and (interactive "f") for backward and forward respectively. When "C-;" is set the minibuffers says it's undefined, when letters are set it just type letters. The call by M-x doesn't do the job either. вт, 17.12.2024 5:28, Drew Adams пишет: >> I assume I would do it by a cycle - delete one char per >> each iteration until the char is a space. > Do what? Delete a word backwards? Did you try the > `my-backward-delete-word' command I defined for you? > >> But I don't know Elisp... > Time to learn a little, if you want to define your > own commands. I recommend you look into the Intro > Elisp manual: `C-h i m intro TAB RET'. > > The command I defined saves the current cursor > location (point); then it uses predefined function > `backward-word', to move backward a word; then it > uses predefined function `delete-region', to delete > the text between the new location (point) and the > original (saved) location. > > If you want to define deletion (not kill) commands, > then use `delete-region' (or other deletion functions). > They're building-block functions, not commands.