all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jeremie Juste <jeremiejuste@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: alt to copy-region-as-kill for kill ring
Date: Sun, 07 Mar 2021 11:35:57 +0100	[thread overview]
Message-ID: <87v9a3p7xu.fsf@gmail.com> (raw)
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")

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



  reply	other threads:[~2021-03-07 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07  8:57 alt to copy-region-as-kill for kill ring Jeremie Juste
2021-03-07  9:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-07 10:35   ` Jeremie Juste [this message]
2021-03-07 14:42     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-07 17:11       ` Jeremie Juste
2021-03-07 18:40         ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9a3p7xu.fsf@gmail.com \
    --to=jeremiejuste@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.