all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* yank-secondary
@ 2008-01-30 21:41 Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2008-01-30 21:41 UTC (permalink / raw)
  To: Emacs-Devel

Any interest in adding something like this? I've used it for years. Hard to
believe it isn't already in Emacs (or is it?). (What do those of you who are
sans souris use?)

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))

I bind it to `C-M-y', so I can access two different selections from the
keyboard.

(FWIW, I also bind the meta mouse stuff to `C-M-', so mouse-yank-secondary
and yank-secondary use the same modifiers. I've done that since I had an SGI
workstation that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I have
`C-M-y' = yank-secondary, `C-M-mouse2' = mouse-yank-secondary, `C-M-mouse-1'
= mouse-start-secondary, `C-M-mouse-3' = mouse-secondary-save-then-kill,
`C-M-drag-mouse-1' = mouse-set-secondary, and `C-M-down-mouse-1' =
mouse-drag-secondary.)





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

* FW: yank-secondary
@ 2008-03-11 18:59 Drew Adams
  2008-05-04 23:15 ` yank-secondary Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-03-11 18:59 UTC (permalink / raw)
  To: 'Emacs-Devel'

Resending. Questions:
 
1) Any interest? 
2) Do you yank the secondary selection (without the mouse)? If so, how?

-------------
Sent: Wednesday, January 30, 2008 1:41 PM
Any interest in adding something like this? I've used it for years. Hard to
believe it isn't already in Emacs (or is it?). (What do those of you who are
sans souris use?)

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))

I bind it to `C-M-y', so I can access two different selections from the
keyboard.

(FWIW, I also bind the meta mouse stuff to `C-M-', so mouse-yank-secondary
and yank-secondary use the same modifiers. I've done that since I had an SGI
workstation that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I have
`C-M-y' = yank-secondary, `C-M-mouse2' = mouse-yank-secondary, `C-M-mouse-1'
= mouse-start-secondary, `C-M-mouse-3' = mouse-secondary-save-then-kill,
`C-M-drag-mouse-1' = mouse-set-secondary, and `C-M-down-mouse-1' =
mouse-drag-secondary.)











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

* RE: yank-secondary
  2008-03-11 18:59 FW: yank-secondary Drew Adams
@ 2008-05-04 23:15 ` Drew Adams
  2008-05-06 15:54   ` yank-secondary Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-05-04 23:15 UTC (permalink / raw)
  To: 'Emacs-Devel'
  Cc: 'Ehud Karni', 'David De La Harpe Golden'

Resending (see below). There was some interest, but not a deluge of response.
This is an update, with some new commands.

David D.L.H.G mentioned that there is no way to create the secondary selection
by keyboard, and that he typically is already using the mouse when he wants to
yank the secondary selection.

That's not my experience. I often yank the secondary selection long after I've
created it. In fact, I typically use the same secondary selection over a period
of editing, whereas I change the primary (region) selection often. That's the
beauty of the secondary selection, to me: it persists even when the region
changes. You can use registers in a similar way, but I find the secondary
selection handy for this.

But what about having a way to create the secondary selection by keyboard? Good
idea. I don't think it's helpful or necessary to duplicate the many ways that
one can define the region, just to do the same for the secondary selection. You
don't need 36 ways to define that.

But it would be useful to be able to create the secondary selection from the
region. That then gives you all of the many region creation methods for free.

I now bind not `yank-secondary' (which I sent previously) but a command that
does the same thing but also lets you use `C-u' to instead create the secondary
selection from the region. I bind it to `C-M-y'.

(defun yank-secondary-or-convert-primary (arg)
  "Insert the secondary selection at point.
Move point to the end of the inserted text.  Does not change mark.
With a prefix arg, make the region into the secondary selection,
instead."
  (interactive "P")
  (if arg
      (call-interactively #'primary-to-secondary)
    (setq this-command 'yank-secondary)
    (when delete-selection-mode   ; Hack!
      (delete-selection-pre-hook))
    (call-interactively #'yank-secondary)))

(defun primary-to-secondary (beg end)
  "Make the region in the current buffer into the secondary selection."
  (interactive "r")
  (setq mouse-secondary-start (make-marker))
  (set-marker mouse-secondary-start beg)
  (if mouse-secondary-overlay
      (move-overlay mouse-secondary-overlay beg end)
    (setq mouse-secondary-overlay (make-overlay beg end))
    (overlay-put mouse-secondary-overlay
      'face 'secondary-selection))
  (x-set-selection 'SECONDARY (buffer-substring beg end)))

IOW, I use `C-M-y' to yank the secondary and `C-u C-M-y' to copy the region text
to the secondary (it still leaves the region active). That's the right way to
create the secondary from the keyboard, I think.

There was also some question of how yanking should interact with
delete-selection mode. I now let it delete the region text, and I find that that
is quite useful. IOW, `C-M-y' with an active region replaces the region text
with the secondary selection. 

Among other things, that provides a handy way to replace text here and there,
without monkeying with the kill-ring order (`M-y'). I also use it sometimes with
isearch the same way, as a way to replace particular search hits on the fly.
(`C-SPC' in my version of isearch-map is a toggle that sets the region around
the search hit when you exit isearch, which is handy here.)

The hack in the `yank-secondary-or-convert-primary' code shows how I make
delete-selection mode DTRT. I didn't find a better way, since delete-selection
mode looks only at the current key's command. Suggestions welcome.

FWIW, I also have a command, `secondary-to-primary', to pop to the buffer of the
secondary selection and select it as the region. It's sort of the opposite of
`primary-to-secondary'. I have not bound it to a key.

(defun secondary-to-primary ()
  "Converts the secondary selection into the active region.
Selects the secondary selection and its buffer in another window."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless (and secondary mouse-secondary-overlay)
      (error "No secondary selection"))
    (x-set-selection 'PRIMARY secondary))
  (switch-to-buffer-other-window
    (overlay-buffer mouse-secondary-overlay))
  (push-mark (overlay-start mouse-secondary-overlay) t t)
  (goto-char (overlay-end mouse-secondary-overlay))
  (setq deactivate-mark nil))

You might give `yank-secondary-or-convert-primary' a try, to see if it's
something that Emacs might benefit from.

Here again is `yank-secondary' (used by `yank-secondary-or-convert-primary'):

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))


-------------8<--------------------
> From: Drew Adams Sent: Tuesday, March 11, 2008 11:59 AM
> Resending. Questions:
>  
> 1) Any interest? 
> 2) Do you yank the secondary selection (without the mouse)? 
> If so, how?
> 
> -------------
> Sent: Wednesday, January 30, 2008 1:41 PM
> Any interest in adding something like this? I've used it for 
> years. Hard to
> believe it isn't already in Emacs (or is it?). (What do those 
> of you who are sans souris use?)
> 
> (defun yank-secondary ()
>   "Insert the secondary selection at point.
> Moves point to the end of the inserted text.  Does not change mark."
>   (interactive)
>   (let ((secondary (x-get-selection 'SECONDARY)))
>     (unless secondary (error "No secondary selection"))
>     (insert secondary)))
> 
> I bind it to `C-M-y', so I can access two different 
> selections from the keyboard.
> 
> (FWIW, I also bind the meta mouse stuff to `C-M-', so 
> mouse-yank-secondary and yank-secondary use the same
> modifiers. I've done that since I had an SGI workstation
> that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I
> have `C-M-y' = yank-secondary, `C-M-mouse2' = 
> mouse-yank-secondary, `C-M-mouse-1'
> = mouse-start-secondary, `C-M-mouse-3' = 
> mouse-secondary-save-then-kill,
> `C-M-drag-mouse-1' = mouse-set-secondary, and
> `C-M-down-mouse-1' = mouse-drag-secondary.)





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

* RE: yank-secondary
  2008-05-04 23:15 ` yank-secondary Drew Adams
@ 2008-05-06 15:54   ` Drew Adams
  2008-05-07  1:55     ` yank-secondary Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-05-06 15:54 UTC (permalink / raw)
  To: 'Emacs-Devel'
  Cc: 'Ehud Karni', 'David De La Harpe Golden'

Dunno if anyone tried the code I sent, but I've since combined the three
commands in one, `yank-secondary-or-swap-w-region': 

* no prefix arg:    yank-secondary
* prefix arg >= 0:  primary-to-secondary
* prefix arg < 0:   secondary-to-primary

I also fixed a minor bug in `primary-to-secondary'.
The code is here, for those who are interested:
http://www.emacswiki.org/cgi-bin/wiki/misc-cmds.el

--------
> From: Drew Adams Sent: Sunday, May 04, 2008 4:15 PM
> Resending (see below). There was some interest, but not a 
> deluge of response. This is an update, with some new commands.
> 
> David D.L.H.G mentioned that there is no way to create the 
> secondary selection by keyboard, and that he typically is
> already using the mouse when he wants to yank the secondary
> selection.
> 
> That's not my experience. I often yank the secondary 
> selection long after I've created it. In fact, I typically
> use the same secondary selection over a period
> of editing, whereas I change the primary (region) selection 
> often. That's the beauty of the secondary selection, to me:
> it persists even when the region changes. You can use
> registers in a similar way, but I find the secondary
> selection handy for this.
> 
> But what about having a way to create the secondary
> selection by keyboard? Good idea. I don't think it's
> helpful or necessary to duplicate the many ways that
> one can define the region, just to do the same for the 
> secondary selection. You don't need 36 ways to define that.
> 
> But it would be useful to be able to create the secondary 
> selection from the region. That then gives you all of the
> many region creation methods for free.
> 
> I now bind not `yank-secondary' (which I sent previously)
> but a command that does the same thing but also lets you
> use `C-u' to instead create the secondary selection from
> the region. I bind it to `C-M-y'.
> 
> (defun yank-secondary-or-convert-primary (arg)
>   "Insert the secondary selection at point.
> Move point to the end of the inserted text.  Does not change mark.
> With a prefix arg, make the region into the secondary selection,
> instead."
>   (interactive "P")
>   (if arg
>       (call-interactively #'primary-to-secondary)
>     (setq this-command 'yank-secondary)
>     (when delete-selection-mode   ; Hack!
>       (delete-selection-pre-hook))
>     (call-interactively #'yank-secondary)))
> 
> (defun primary-to-secondary (beg end)
>   "Make the region in the current buffer into the secondary 
> selection."
>   (interactive "r")
>   (setq mouse-secondary-start (make-marker))
>   (set-marker mouse-secondary-start beg)
>   (if mouse-secondary-overlay
>       (move-overlay mouse-secondary-overlay beg end)
>     (setq mouse-secondary-overlay (make-overlay beg end))
>     (overlay-put mouse-secondary-overlay
>       'face 'secondary-selection))
>   (x-set-selection 'SECONDARY (buffer-substring beg end)))
> 
> IOW, I use `C-M-y' to yank the secondary and `C-u C-M-y' to 
> copy the region text to the secondary (it still leaves the
> region active). That's the right way to
> create the secondary from the keyboard, I think.
> 
> There was also some question of how yanking should interact with
> delete-selection mode. I now let it delete the region text, 
> and I find that that is quite useful. IOW, `C-M-y' with an
> active region replaces the region text
> with the secondary selection. 
> 
> Among other things, that provides a handy way to replace text 
> here and there, without monkeying with the kill-ring order
> (`M-y'). I also use it sometimes with isearch the same way,
> as a way to replace particular search hits on the fly.
> (`C-SPC' in my version of isearch-map is a toggle that sets 
> the region around the search hit when you exit isearch, which
> is handy here.)
> 
> The hack in the `yank-secondary-or-convert-primary' code 
> shows how I make delete-selection mode DTRT. I didn't find a
> better way, since delete-selection mode looks only at the
> current key's command. Suggestions welcome.
> 
> FWIW, I also have a command, `secondary-to-primary', to pop 
> to the buffer of the secondary selection and select it as
> the region. It's sort of the opposite of
> `primary-to-secondary'. I have not bound it to a key.
> 
> (defun secondary-to-primary ()
>   "Converts the secondary selection into the active region.
> Selects the secondary selection and its buffer in another window."
>   (interactive)
>   (let ((secondary (x-get-selection 'SECONDARY)))
>     (unless (and secondary mouse-secondary-overlay)
>       (error "No secondary selection"))
>     (x-set-selection 'PRIMARY secondary))
>   (switch-to-buffer-other-window
>     (overlay-buffer mouse-secondary-overlay))
>   (push-mark (overlay-start mouse-secondary-overlay) t t)
>   (goto-char (overlay-end mouse-secondary-overlay))
>   (setq deactivate-mark nil))
> 
> You might give `yank-secondary-or-convert-primary' a try, to 
> see if it's something that Emacs might benefit from.
> 
> Here again is `yank-secondary' (used by 
> `yank-secondary-or-convert-primary'):
> 
> (defun yank-secondary ()
>   "Insert the secondary selection at point.
> Moves point to the end of the inserted text.  Does not change mark."
>   (interactive)
>   (let ((secondary (x-get-selection 'SECONDARY)))
>     (unless secondary (error "No secondary selection"))
>     (insert secondary)))
> 
> -------------8<--------------------
> > From: Drew Adams Sent: Tuesday, March 11, 2008 11:59 AM
> > Resending. Questions:
> >  
> > 1) Any interest? 
> > 2) Do you yank the secondary selection (without the mouse)? 
> > If so, how?
> > 
> > -------------
> > Sent: Wednesday, January 30, 2008 1:41 PM
> > Any interest in adding something like this? I've used it for 
> > years. Hard to
> > believe it isn't already in Emacs (or is it?). (What do those 
> > of you who are sans souris use?)
> > 
> > (defun yank-secondary ()
> >   "Insert the secondary selection at point.
> > Moves point to the end of the inserted text.  Does not change mark."
> >   (interactive)
> >   (let ((secondary (x-get-selection 'SECONDARY)))
> >     (unless secondary (error "No secondary selection"))
> >     (insert secondary)))
> > 
> > I bind it to `C-M-y', so I can access two different 
> > selections from the keyboard.
> > 
> > (FWIW, I also bind the meta mouse stuff to `C-M-', so 
> > mouse-yank-secondary and yank-secondary use the same
> > modifiers. I've done that since I had an SGI workstation
> > that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I
> > have `C-M-y' = yank-secondary, `C-M-mouse2' = 
> > mouse-yank-secondary, `C-M-mouse-1'
> > = mouse-start-secondary, `C-M-mouse-3' = 
> > mouse-secondary-save-then-kill,
> > `C-M-drag-mouse-1' = mouse-set-secondary, and
> > `C-M-down-mouse-1' = mouse-drag-secondary.)





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

* Re: yank-secondary
  2008-05-06 15:54   ` yank-secondary Drew Adams
@ 2008-05-07  1:55     ` Stefan Monnier
  2008-05-07  2:40       ` yank-secondary Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2008-05-07  1:55 UTC (permalink / raw)
  To: Drew Adams
  Cc: 'Ehud Karni', 'David De La Harpe Golden',
	'Emacs-Devel'

> Dunno if anyone tried the code I sent, but I've since combined the three
> commands in one, `yank-secondary-or-swap-w-region':

> * no prefix arg:    yank-secondary
> * prefix arg >= 0:  primary-to-secondary
> * prefix arg < 0:   secondary-to-primary

Why not just either yank and swap primary<->secondary?
Also it can just be called secondary-dwim.


        Stefan




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

* RE: yank-secondary
  2008-05-07  1:55     ` yank-secondary Stefan Monnier
@ 2008-05-07  2:40       ` Drew Adams
  2008-05-07  3:15         ` yank-secondary Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-05-07  2:40 UTC (permalink / raw)
  To: 'Stefan Monnier'
  Cc: 'Ehud Karni', 'David De La Harpe Golden',
	'Emacs-Devel'

> > Dunno if anyone tried the code I sent, but I've
> > since combined the three commands in one,
> > `yank-secondary-or-swap-w-region':
> 
> > * no prefix arg:    yank-secondary
> > * prefix arg >= 0:  primary-to-secondary
> > * prefix arg < 0:   secondary-to-primary
> 
> Why not just either yank and swap primary<->secondary?
> Also it can just be called secondary-dwim.

I don't know what you're suggesting. I don't know what you mean here by
"either...and" and by "swap primary<->secondary".

Here is the code I have, so you can see more clearly what I meant. Let me know
more precisely what you have in mind. I have no problem with renaming commands
or other changes.

Note that `primary-to-secondary' and `secondary-to-primary' are not exact
opposites. The first puts the secondary selection (also) on the (current
buffer's) region text. The second pops to the buffer that has the secondary
selection and selects that text as the active region.

The first is more useful than the second. In particular, it indirectly gives you
different ways to create the secondary selection using the keyboard. For
example, you can use `C-M-@' to mark a sexp and then `C-u C-M-y' to select it as
the secondary (assuming that `C-M-y' is bound to
`yank-secondary-or-swap-w-region ').

Yanking the secondary is the most useful of the three, which is why it needs no
prefix arg. It is particularly useful with delete-selection mode, although I
just started using it that way recently.

(defun yank-secondary-or-swap-w-region (arg) ; I bind it to `C-M-y'
  "Insert the secondary selection at point.  Prefix arg: swap with region.
Move point to the end of the inserted text.  Leave mark where it was.
With a prefix arg, swap the region and secondary selections instead,
in this way:
 Arg >= 0: Make the region into the secondary selection.
 Arg <  0: Convert the secondary selection into the region."
  (interactive "P")
  (cond (arg
         (setq arg (prefix-numeric-value arg))
         (if (wholenump arg)
             (call-interactively #'primary-to-secondary)
           (call-interactively #'secondary-to-primary)))
        (t
         (setq this-command 'yank-secondary)
         (when delete-selection-mode
           (delete-selection-pre-hook)) ; Hack!
         (call-interactively #'yank-secondary))))

(defun primary-to-secondary (beg end)
  "Make the region in the current buffer into the secondary selection."
  (interactive "r")
  (setq mouse-secondary-start (make-marker))
  (set-marker mouse-secondary-start beg)
  (if mouse-secondary-overlay
      (move-overlay mouse-secondary-overlay 
                    beg end (current-buffer))
    (setq mouse-secondary-overlay
          (make-overlay beg end (current-buffer)))
    (overlay-put mouse-secondary-overlay
                 'face 'secondary-selection))
  (x-set-selection 'SECONDARY (buffer-substring beg end)))

(defun secondary-to-primary ()
  "Convert the secondary selection into the active region.
Select the secondary selection and pop to its buffer."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless (and secondary mouse-secondary-overlay)
      (error "No secondary selection"))
    (x-set-selection 'PRIMARY secondary))
  (pop-to-buffer (overlay-buffer mouse-secondary-overlay))
  (push-mark (overlay-start mouse-secondary-overlay) t t)
  (goto-char (overlay-end mouse-secondary-overlay))
  (setq deactivate-mark nil))

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))

;; Tell `delete-selection-mode' to replace active region
;; by yanked secondary selection.
(put 'yank-secondary 'delete-selection 'yank)

----------------

FWIW, this is the code I'm using for the Edit menu.

As mentioned in thread "x-selection-exists-p vs  x-get-selection", I use
`x-get-selection' instead of `x-selection-exists-p' for the `SECONDARY' because
the latter doesn't seem to work, at least on Windows. I think that is a bug, but
I never got a clear confirmation. I use `x-selection-enable-clipboard' also.

(when (fboundp 'yank-secondary)
  (define-key-after menu-bar-edit-menu [yank-secondary]
    '(menu-item "Paste Secondary" yank-secondary
      :help "Paste secondary selection."
      :enable
      (and (fboundp 'x-get-selection)
           (x-get-selection 'SECONDARY)
           (not buffer-read-only))
      :keys "\\[yank-secondary-or-swap-w-region]")
    'paste)
  (define-key-after menu-bar-edit-menu [primary-to-secondary]
    '(menu-item "Region to Secondary" primary-to-secondary
      :help "Make the region into the secondary selection."
      :enable mark-active
      :keys "C-1 \\[yank-secondary-or-swap-w-region]")
    'yank-secondary)
  (define-key-after menu-bar-edit-menu [secondary-to-primary]
    '(menu-item "Secondary to Region" secondary-to-primary
      :help "Convert the secondary selection into the active region."
      :enable (and (fboundp 'x-get-selection)
                   (x-get-selection 'SECONDARY))
      :keys "C-- 1 \\[yank-secondary-or-swap-w-region]")
    'primary-to-secondary))





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

* Re: yank-secondary
  2008-05-07  2:40       ` yank-secondary Drew Adams
@ 2008-05-07  3:15         ` Stefan Monnier
  2008-05-07  6:27           ` yank-secondary Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2008-05-07  3:15 UTC (permalink / raw)
  To: Drew Adams
  Cc: 'Ehud Karni', 'David De La Harpe Golden',
	'Emacs-Devel'

>> > Dunno if anyone tried the code I sent, but I've
>> > since combined the three commands in one,
>> > `yank-secondary-or-swap-w-region':
>> 
>> > * no prefix arg:    yank-secondary
>> > * prefix arg >= 0:  primary-to-secondary
>> > * prefix arg < 0:   secondary-to-primary
>> 
>> Why not just either yank and swap primary<->secondary?
>> Also it can just be called secondary-dwim.

> I don't know what you're suggesting. I don't know what you mean here by
> "either...and"
            ^^^
should be   or

> and by "swap primary<->secondary".

You know... "swap" aka "exchange", i.e. both primary-to-secondary and
secondary-to-primary at the same time.
          

        Stefan




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

* RE: yank-secondary
  2008-05-07  3:15         ` yank-secondary Stefan Monnier
@ 2008-05-07  6:27           ` Drew Adams
  2008-05-07 15:01             ` yank-secondary Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-05-07  6:27 UTC (permalink / raw)
  To: 'Stefan Monnier'
  Cc: 'Ehud Karni', 'David De La Harpe Golden',
	'Emacs-Devel'

> >> > * no prefix arg:    yank-secondary
> >> > * prefix arg >= 0:  primary-to-secondary
> >> > * prefix arg < 0:   secondary-to-primary
> >> 
> >> Why not just either yank and swap primary<->secondary?
> >> Also it can just be called secondary-dwim.
> 
> > I don't know what you're suggesting.
> 
> You know... "swap" aka "exchange", i.e. both primary-to-secondary and
> secondary-to-primary at the same time.

I don't see how that would make any sense. Did you read the rest of my message
or look at what the commands `primary-to-secondary' and `secondary-to-primary'
do?

Or are you proposing something entirely different from those commands, reacting
only to the names? If you mean to simply exchange the primary and secondary
selections, then I don't see how that would be useful. I can't imagine a use
case, whether the text with the secondary selection is in the current buffer or
(more generally) not. 

With such a swap, the cursor would always move to the end (or beginning) of the
secondary selection. That movement is precisely why I said that (my)
`secondary-to-primary' is much less useful than (my) `primary-to-secondary':
it's not too often that you want to move to where the secondary selection is.
(And when you do, I can't imagine why you would at the same time want to make
the previous region the new secondary.)

The only use case I see for such a movement (my `secondary-to-primary') is as
something akin to `C-x C-SPC' or `C-u C-SPC' or `C-x r j' or `C-x r b': to get
back to where the secondary was. More often, you just want to stay where you are
but pick up the region text as the new secondary selection also (my
`primary-to-secondary').

Could you please elaborate?

It's easy enough to try the commands I sent, and it's presumably easy enough to
define the command you have in mind. Why don't you try and then speak to the
use? These are not complicated definitions. It's a lot easier to follow a simple
Lisp definition than a vague 'y a qu'a.






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

* Re: yank-secondary
  2008-05-07  6:27           ` yank-secondary Drew Adams
@ 2008-05-07 15:01             ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2008-05-07 15:01 UTC (permalink / raw)
  To: Drew Adams
  Cc: 'Ehud Karni', 'David De La Harpe Golden',
	'Emacs-Devel'

>> >> Why not just either yank and swap primary<->secondary?
[...]

> With such a swap, the cursor would always move to the end (or
> beginning) of the secondary selection. That movement is precisely why
> I said that (my) `secondary-to-primary' is much less useful than (my)
> `primary-to-secondary': it's not too often that you want to move to
> where the secondary selection is.  (And when you do, I can't imagine
> why you would at the same time want to make the previous region the
> new secondary.)

I see, thanks,


        Stefan




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

end of thread, other threads:[~2008-05-07 15:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11 18:59 FW: yank-secondary Drew Adams
2008-05-04 23:15 ` yank-secondary Drew Adams
2008-05-06 15:54   ` yank-secondary Drew Adams
2008-05-07  1:55     ` yank-secondary Stefan Monnier
2008-05-07  2:40       ` yank-secondary Drew Adams
2008-05-07  3:15         ` yank-secondary Stefan Monnier
2008-05-07  6:27           ` yank-secondary Drew Adams
2008-05-07 15:01             ` yank-secondary Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2008-01-30 21:41 yank-secondary Drew Adams

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.