how to inject strings

Hi Everybody,

I frequently dislike having to use the mouse to paste the selection.

So i wrote a function to do it. The problem is that it s slow. is there
a better way to do this? It just occurred to me, but perhaps there is a
command that I can call that does it in sawfish and here i am
reinventing the wheel :)

thanks for any help. If anybody is interested I can post the entire


(defun dmg-type-in-window (str wind #!optional ret)
  (cond ((string= str "") 
         (when ret (synthesize-event "Return" wind)))
        (t (if (string= (substring str 0 1) "\n")
               (synthesize-event "Return" wind)
             (synthesize-event (substring str 0 1) wind))
           (dmg-type-in-window (substring str 1) wind ret))))

(defun dmg-paste-clipboard (w)
  (interactive "%W")
  (setq sel  (x-get-selection 'CLIPBOARD))
  (dmg-type-in-window sel w)

(defun dmg-paste-primary (w)
  (interactive "%W")
  (setq sel  (x-get-selection 'PRIMARY))
  (dmg-type-in-window sel w)

(defun dmg-paste-secondary (w)
  (interactive "%W")
  (setq sel  (x-get-selection 'SECONDARY))
  (dmg-type-in-window sel w)

Daniel M. German         
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

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