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

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

Re: copy/paste & Emacs on XWindows


From: Ittay Dror
Subject: Re: copy/paste & Emacs on XWindows
Date: 20 Mar 2003 07:59:07 +0200

On Wed, 2003-03-19 at 20:41, Peter Lee wrote:
> Ittay Dror <ittay@qlusters.com> writes:
> 
> > i have this hack:
> > (defun if-copy-mark-to-primary-selection ()
> >   (if mark-active
> >       (x-set-selection 'PRIMARY (buffer-substring (region-beginning)
> > (region-end)))))
> > 
> > (add-hook 'post-command-hook 'if-copy-mark-to-primary-selection)
> > 
> > what it does is copy the region to the primary selection, (which is not
> > the clipboard), use the middle mouse button to paste it in another
> > window. if you wish to copy to the clipboard, change PRIMARY to
> > CLIPBOARD.
> 
> Thanks a bunch!  I will try this when I get home.  One other
> thing... what about copying from clipboard to Emacs?  Any tricks for
> that ?  Or should that just work as is?  
it should work as it. check that the variable x-select-enable-clipboard
is set to t. however, i think that the middle mouse button will try to
paste from there and not the primary selection, as it normally does.
anyway, below are other hacks i use. 

(defadvice mouse-yank-at-click (around yank-from-primary last act)
  "i want the middle mouse button to always paste the primary selection"
  (let ((x-select-enable-clipboard nil))
        ad-do-it))

(defadvice mouse-set-region (around kill-to-primary last act)
  "i want the mouse drags to copy only to primary selection"
  (let ((x-select-enable-clipboard nil))
        ad-do-it))

(defadvice mouse-drag-region (around kill-to-primary last act)
  "i want the mouse drags to copy only to primary selection"
  (let ((x-select-enable-clipboard nil))
        ad-do-it))


and while i'm at it, these are my hacks for using the cut buffers
instead of the kill ring (if you use kde, then the cut buffers is the
history you see in klipper).

(defadvice current-kill (around use-cut-buffer first act)
  "use the cut buffer instead of the kill ring"
   (let ((text (if (> n 0)
                                  (x-get-cut-buffer n)
                                ad-do-it)))
        (setq ad-return-value text)))

(defadvice yank (before fix-arg last act)
  "when invoked with prefix argument, yank passes current-kill the value
of arg-1. so if
i do <esc> 1 <shift>-<insert>, i get the same as just <shift>-<insert>"
  (if (not (or (listp arg) (eq arg '-)))
          (setq arg (1+ arg))))


-- 
===================================
Ittay Dror (ittay@qlusters.com)
User Space Team, R&D
Qlusters Inc.
+972-3-6081976 Fax: +972-3-6081841





reply via email to

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