help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alt to copy-region-as-kill for kill ring


From: Jeremie Juste
Subject: Re: alt to copy-region-as-kill for kill ring
Date: Sun, 07 Mar 2021 11:35:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]