all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question Kill-ring modify last entry.
@ 2019-07-28 21:45 Ergus
  2019-07-29 14:18 ` Eli Zaretskii
  2019-07-29 14:43 ` Robert Pluim
  0 siblings, 2 replies; 5+ messages in thread
From: Ergus @ 2019-07-28 21:45 UTC (permalink / raw)
  To: emacs-devel

Hi:

I have been reading the elisp documentation and it is unclear for me if
there is a "canonical" (lets say formal/supported/provided/save)
function to replace the last entry in the kill-ring with a new one (like
the append option).

I have been playing with `current-kill` or just making (pop kill-ring)
before killing again but maybe there is a better alternative?

Thanks in advance,
Ergus



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question Kill-ring modify last entry.
  2019-07-28 21:45 Question Kill-ring modify last entry Ergus
@ 2019-07-29 14:18 ` Eli Zaretskii
  2019-07-29 14:43 ` Robert Pluim
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2019-07-29 14:18 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

> Date: Sun, 28 Jul 2019 23:45:15 +0200
> From: Ergus <spacibba@aol.com>
> 
> I have been reading the elisp documentation and it is unclear for me if
> there is a "canonical" (lets say formal/supported/provided/save)
> function to replace the last entry in the kill-ring with a new one (like
> the append option).

kill-new with its REPLACE argument non-nil, I think.  Is this what you
are looking for?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question Kill-ring modify last entry.
  2019-07-28 21:45 Question Kill-ring modify last entry Ergus
  2019-07-29 14:18 ` Eli Zaretskii
@ 2019-07-29 14:43 ` Robert Pluim
  2019-07-29 18:10   ` Ergus
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2019-07-29 14:43 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

>>>>> On Sun, 28 Jul 2019 23:45:15 +0200, Ergus <spacibba@aol.com> said:

    Ergus> Hi:
    Ergus> I have been reading the elisp documentation and it is unclear for me if
    Ergus> there is a "canonical" (lets say formal/supported/provided/save)
    Ergus> function to replace the last entry in the kill-ring with a new one (like
    Ergus> the append option).

kill-new has a 'replace' argument, so:

(kill-new "foo" t)

(unless Iʼve misunderstood what youʼre asking for)

Robert



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question Kill-ring modify last entry.
  2019-07-29 14:43 ` Robert Pluim
@ 2019-07-29 18:10   ` Ergus
  2019-07-29 18:42     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ergus @ 2019-07-29 18:10 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

Hi:

I have already seen kill-new. I was just preventing myself to reinvent
the wheel in case there were something else already there.

I was looking for something like `append-next-kill` that I could use for
`copy-region-as-kill` (or similar), but for replace instead of
appending and acting on regions instead of passing the string already
manipulated.

Ideally I thought that the higher level functions (kill-region,
copy-region-as-kill) somehow unified the lower level functions
(kill-append, kill-new). Maybe throw parameters.

But ok, thanks.

I know what to do now :)


On Mon, Jul 29, 2019 at 04:43:24PM +0200, Robert Pluim wrote:
>>>>>> On Sun, 28 Jul 2019 23:45:15 +0200, Ergus <spacibba@aol.com> said:
>
>    Ergus> Hi:
>    Ergus> I have been reading the elisp documentation and it is unclear for me if
>    Ergus> there is a "canonical" (lets say formal/supported/provided/save)
>    Ergus> function to replace the last entry in the kill-ring with a new one (like
>    Ergus> the append option).
>
>kill-new has a 'replace' argument, so:
>
>(kill-new "foo" t)
>
>(unless I??ve misunderstood what you??re asking for)
>
>Robert
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question Kill-ring modify last entry.
  2019-07-29 18:10   ` Ergus
@ 2019-07-29 18:42     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2019-07-29 18:42 UTC (permalink / raw)
  To: Ergus; +Cc: rpluim, emacs-devel

> Date: Mon, 29 Jul 2019 20:10:43 +0200
> From: Ergus <spacibba@aol.com>
> Cc: emacs-devel@gnu.org
> 
> I have already seen kill-new. I was just preventing myself to reinvent
> the wheel in case there were something else already there.
> 
> I was looking for something like `append-next-kill` that I could use for
> `copy-region-as-kill` (or similar), but for replace instead of
> appending and acting on regions instead of passing the string already
> manipulated.

append-next-kill just arranges the next kill to call kill-new with the
REPLACE argument non-nil, that's all.  There's no magic there.  the
easiest way to mimic what append-next-kill does in your commands is to
call kill-new with that argument non-nil.

You asked about the "canonical" way of doing this; that way is to call
kill-new.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-29 18:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-28 21:45 Question Kill-ring modify last entry Ergus
2019-07-29 14:18 ` Eli Zaretskii
2019-07-29 14:43 ` Robert Pluim
2019-07-29 18:10   ` Ergus
2019-07-29 18:42     ` Eli Zaretskii

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.