[MSLUG] 'meta-paste'

Guillaume Germain germaing at iro.umontreal.ca
Thu Aug 19 16:31:56 EDT 2004


Hello everyone,

being jealous of Guillaume Cartier's Jazz system, I've implemented the 
"alt-click" functionality of Jazz into Emacs. It probably already existed 
somewhere with a better name, but I couldn't find it, out of means to 
describe it to a search engine.

I've tentatively called it 'meta-paste' and I bind it to "Alt-Shift-Click" 
on my system.

Hope someone finds this useful,

(the other)
Guillaume

PS- G. Cartier: nice presentation yesterday. Jazz is very cool.
-------------- next part --------------
;; author: Guillaume Germain <germaing at iro.umontreal.ca>
(defun meta-paste (event)
  "Paste the sexp at mouse click position to the current cursor
position, inserting the sexp if on whitespace or else replacing the
current sexp."
  (interactive "e")
  (save-excursion
    (mouse-set-point event)
    (mark-sexp)
    (kill-ring-save (point) (mark)))
  (cond
   ((not (or (looking-at "\\s-") 
	     (eolp)	     
	     (looking-at "[)]")))
    (mark-sexp)
    (kill-region (point) (mark))
    (yank 2))
   (t (forward-char -1)
      (cond
       ((not (or (looking-at "\\s-") 
		 (eolp)))
	(forward-char 1)
	(insert " "))
       (forward-char))
      (yank 1))))

(global-set-key (kbd "M-S-<mouse-1>") 'meta-paste)


More information about the MSLUG mailing list