From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeremie Juste Newsgroups: gmane.emacs.help Subject: Re: alt to copy-region-as-kill for kill ring Date: Sun, 07 Mar 2021 11:35:57 +0100 Organization: Emacs is it Message-ID: <87v9a3p7xu.fsf@gmail.com> References: <8735x7qr2z.fsf@gmail.com> <87mtvfuwnl.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7842"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 11:36:23 2021 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 1lIqlr-0001w6-BB for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 11:36:23 +0100 Original-Received: from localhost ([::1]:41630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIqlq-0008SM-DV for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 05:36:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIqlW-0008Rt-RI for help-gnu-emacs@gnu.org; Sun, 07 Mar 2021 05:36:02 -0500 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:44876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIqlV-0005Zw-6v for help-gnu-emacs@gnu.org; Sun, 07 Mar 2021 05:36:02 -0500 Original-Received: by mail-wr1-x429.google.com with SMTP id h98so8170205wrh.11 for ; Sun, 07 Mar 2021 02:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:organization:references:date:in-reply-to:message-id :user-agent:mime-version; bh=jO42vZzTaUGy34FEPO4ain2TYWBNQmBN3tutQJJ826k=; b=R4lonltcyssK/bsOajdL4KIUIr9kF37hon+AUI5K2N4eZSiRIKCPiiaAdQRxbDcYFt erNOg34eb+6Qn8wosxVORzOFsgk+VQvLbU04dF8Vm8abKAy/G8zv0S8M6rESDM9LzE5t o7Uno3C55Ao3nZaI+Ow6H6tTzCka55g3xSDKeaKaf2jb5b5c+dOB/9TgtFiW0QvMQel0 KS/KMUzdnUVhiburz9BHO5VrOLbBnRNVkaoE5U/7ES/p7BrEAFTWWoXx9vrYS55SThtf lUjlp3jFg4ZVu5a4myqsADdsv70I1vvDQH6fJz6KVpjDTUJrEWlQgC/BGpfX5WgldRGv ujzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=jO42vZzTaUGy34FEPO4ain2TYWBNQmBN3tutQJJ826k=; b=CxwZSwqCvAUaOUQKlTwnUyUykkzUtHrIAGpWggoJSY3I4VXeU6s7qDnCjKU82SZxnQ 1fB0kA0pjKtIyIFXMFimbFmPsKZwJPtG+SV0HykK4REaWv2p6SRCBcT/aZc6rOWYhBL8 D273i9VAQJ7v5+nzWSiFQnpVfTNytQmi8O+IuIDB2NL1YiwWqzK6ocye8Cy3B11VyfRi D2dV3jQpad56vtimLcLuX8DQqaFA6urhKJf+ofq6XLsqNwqBQDlCGa8n3lJkqWxGCRC1 RvWAZKm0wgVBqSRg8cqNWNBaouEzoBNhDTejuPeZITHjmn26cjPOhI36Txgc/hMuyhc3 +utA== X-Gm-Message-State: AOAM531rKxnfAMnyCsd3ZqPa7E/xQp0aqtn/hz2UTpzAF2d1+8aAY1m8 bnilrZPh/nhT+mMFz92OyFXkgb6yIA0= X-Google-Smtp-Source: ABdhPJxbZfpSq1X0jKKbFTnJFwj7J5ICYsnbzbFGkJ8i0xILEx1dPYZWtoHJbZyF0NbQ0twzHv4ZUw== X-Received: by 2002:a5d:4688:: with SMTP id u8mr17744510wrq.39.1615113359269; Sun, 07 Mar 2021 02:35:59 -0800 (PST) Original-Received: from freegnu (82-64-129-7.subs.proxad.net. [82.64.129.7]) by smtp.gmail.com with ESMTPSA id m3sm12389215wmc.48.2021.03.07.02.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 02:35:58 -0800 (PST) In-Reply-To: <87mtvfuwnl.fsf@zoho.eu> (Emanuel Berg via Users list for the's message of "Sun, 07 Mar 2021 10:43:10 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=jeremiejuste@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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:128359 Archived-At: Hello Emanuel, || > On Sunday, 7 Mar 2021 at 10:43, Emanuel Berg via Users list for the GNU Emacs text editor wrote: || >> Jeremie Juste wrote: Many thanks for your suggestions. My coding style needs improvement and I will use checkdoc-defun from now on. You are right about the RE as well. The function has greatly improved, (require 'avy) # available on MELPA (defun boomrang (query-char) "Kill word and come back to point. Argument QUERY-CHAR The first character of the word to be copied." (interactive "cchar: Query Char:") (save-window-excursion (avy-goto-word-1 query-char) (copy-region-as-kill (point) (when (re-search-forward "[[:alnum:]_-]+" (point-max) t) (point)))) (yank)) > OK, it should be required, then (require 'avy) - hm... avy has indeed many tools for copying lines and regions, which I happily use, but I didn't any suggestions for words. >> There are a few limitations to it: - if the word is in >> a different buffer it yank it but the cursor does > > `save-window-excursion'? It did solve this problem thanks. >> - If we bind the function to a key (say C-'), it is rather >> difficult to control the copy-region-as-kill as when used >> with this function it behaves like C-M-w (see function >> kill-ring-save). When I use boomrang just after I killed something, I get the same behavior as one would use C-M-w (append-next-kill &optional INTERACTIVE). I was look for a way to bypass this append-next-kill Best regards, Jeremie