all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Move yanked entry to front of kill ring instead of other way around
@ 2007-11-21 10:48 bramadams
  2007-11-22  5:54 ` Kevin Rodgers
       [not found] ` <mailman.3931.1195711151.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: bramadams @ 2007-11-21 10:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm using OSX Aquamacs 1.2a (based on emacs 22), but the following
issue also occurs on e.g. Slackware 10.2's emacs (21.4.2).

If one kills a number of things in a row, e.g. "haha", "hoho" and
"hihi", and then yanks the second-to-last ("hoho"), the front of the
kill ring has moved to "hoho". If one then wants to yank "hihi", one
needs to cycle back through the whole kill ring until it overflows
again and the last killed entries are reached again. This can be
tedious after editing for a while.

Is there some command which allows to either cycle backwards in the
kill ring (from the front to the newer entries; "undo" does not work
for this), or (better yet) to physically move a yanked entry to the
front of the ring? In that case, in my example "hoho" and "hihi" would
just swap places.

Kind regards,

Bram Adams

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

* Re: Move yanked entry to front of kill ring instead of other way around
  2007-11-21 10:48 Move yanked entry to front of kill ring instead of other way around bramadams
@ 2007-11-22  5:54 ` Kevin Rodgers
       [not found] ` <mailman.3931.1195711151.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2007-11-22  5:54 UTC (permalink / raw)
  To: help-gnu-emacs

bramadams wrote:
> Hi,
> 
> I'm using OSX Aquamacs 1.2a (based on emacs 22), but the following
> issue also occurs on e.g. Slackware 10.2's emacs (21.4.2).
> 
> If one kills a number of things in a row, e.g. "haha", "hoho" and
> "hihi", and then yanks the second-to-last ("hoho"), the front of the
> kill ring has moved to "hoho". If one then wants to yank "hihi", one
> needs to cycle back through the whole kill ring until it overflows
> again and the last killed entries are reached again. This can be
> tedious after editing for a while.
> 
> Is there some command which allows to either cycle backwards in the
> kill ring (from the front to the newer entries; "undo" does not work
> for this), or (better yet) to physically move a yanked entry to the
> front of the ring? In that case, in my example "hoho" and "hihi" would
> just swap places.

Isn't it just a matter of providing a negative prefix arg to yank (C-y)
or yank-pop (M-y)?  E.g. `M- C-y' or `C-y M- M-y'

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: Move yanked entry to front of kill ring instead of other way  around
       [not found] ` <mailman.3931.1195711151.18990.help-gnu-emacs@gnu.org>
@ 2007-11-22  8:45   ` bramadams
  2007-11-22 16:07     ` Mathias Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: bramadams @ 2007-11-22  8:45 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

On 22 nov, 06:54, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> Isn't it just a matter of providing a negative prefix arg to yank (C-y)
> or yank-pop (M-y)?  E.g. `M- C-y' or `C-y M- M-y'

I tried this, but to no avail.

Kind regards,

Bram Adams

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

* Re: Move yanked entry to front of kill ring instead of other way around
  2007-11-22  8:45   ` bramadams
@ 2007-11-22 16:07     ` Mathias Dahl
  2007-11-22 16:34       ` bramadams
  0 siblings, 1 reply; 7+ messages in thread
From: Mathias Dahl @ 2007-11-22 16:07 UTC (permalink / raw)
  To: help-gnu-emacs

bramadams <adams.bram@gmail.com> writes:

> On 22 nov, 06:54, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
>> Isn't it just a matter of providing a negative prefix arg to yank (C-y)
>> or yank-pop (M-y)?  E.g. `M- C-y' or `C-y M- M-y'
>
> I tried this, but to no avail.

I tried it too and it worked. Do C-y, then C-- and then M-y. Then M-y
works in the other direction.

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

* Re: Move yanked entry to front of kill ring instead of other way  around
  2007-11-22 16:07     ` Mathias Dahl
@ 2007-11-22 16:34       ` bramadams
  2007-11-26 16:17         ` bramadams
  0 siblings, 1 reply; 7+ messages in thread
From: bramadams @ 2007-11-22 16:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

On 22 nov, 17:07, Mathias Dahl <brakjol...@gmail.com> wrote:
> I tried it too and it worked. Do C-y, then C-- and then M-y. Then M-y
> works in the other direction.

OK, so Kevin meant something like M-- instead of M- :-). This idea
(both the "C-y C-- M-y" and "C-y M-- M-y" incarnation) indeed work,
thanks Kevin and Mathias!

However, I wonder whether there is also some solution where the most
recently yanked entry is physically transferred to the front of the
ring instead of the other way around. Of course, in that case the ring
is not really a pure ring anymore...

Kind regards,

Bram Adams

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

* Re: Move yanked entry to front of kill ring instead of other way  around
  2007-11-22 16:34       ` bramadams
@ 2007-11-26 16:17         ` bramadams
  2007-12-05 17:08           ` Mathias Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: bramadams @ 2007-11-26 16:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

On 22 nov, 17:34, bramadams <adams.b...@gmail.com> wrote:
> However, I wonder whether there is also some solution where the most
> recently yanked entry is physically transferred to the front of the
> ring instead of the other way around. Of course, in that case the ring
> is not really a pure ring anymore...

I've been browsing a bit through the elisp manual (http://www.gnu.org/
software/emacs/manual/html_node/elisp/The-Kill-Ring.html#The-Kill-
Ring), and the behaviour above apparently is not that easy to obtain.
Advising functions would be the way to go, but there may be some
problems with the interplay between yanking and undoing.

Suppose the ring contains ("a" "b" "c") with "a" as the oldest entry.
If one presses C-y followed by M-y, one should not immediately move
the resulting "b" to the front of the kill ring, as there could be
other M-y or C-_ invocations before the current yank process ends,
i.e. the actual desired data is found. Then, the ring's front should
move back to its original position, with the yanked data moved to the
front (if needed).

Did anyone ever try to pursue something similar, i.e. change the
current kill ring behaviour?

Kind regards,

Bram Adams

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

* Re: Move yanked entry to front of kill ring instead of other way around
  2007-11-26 16:17         ` bramadams
@ 2007-12-05 17:08           ` Mathias Dahl
  0 siblings, 0 replies; 7+ messages in thread
From: Mathias Dahl @ 2007-12-05 17:08 UTC (permalink / raw)
  To: help-gnu-emacs

bramadams <adams.bram@gmail.com> writes:

> Suppose the ring contains ("a" "b" "c") with "a" as the oldest entry.
> If one presses C-y followed by M-y, one should not immediately move
> the resulting "b" to the front of the kill ring, as there could be
> other M-y or C-_ invocations before the current yank process ends,
> i.e. the actual desired data is found. Then, the ring's front should
> move back to its original position, with the yanked data moved to the
> front (if needed).

IIRC what really happens is that you just move a "pointer" each time
you do M-y, the content itself never moves. When this pointer reach
the end of the ring, it wraps around to the beginning.

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

end of thread, other threads:[~2007-12-05 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 10:48 Move yanked entry to front of kill ring instead of other way around bramadams
2007-11-22  5:54 ` Kevin Rodgers
     [not found] ` <mailman.3931.1195711151.18990.help-gnu-emacs@gnu.org>
2007-11-22  8:45   ` bramadams
2007-11-22 16:07     ` Mathias Dahl
2007-11-22 16:34       ` bramadams
2007-11-26 16:17         ` bramadams
2007-12-05 17:08           ` Mathias Dahl

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.