;; Temporary workaround for GNU Emacs bug #6635 on x11 systems. ;; 2010-07-24 DG (defun mouse-yank-primary (click) "Insert the primary selection at the position clicked on. Move point to the end of the inserted text. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (when select-active-regions ;; Without this, confusing things happen upon e.g. inserting into ;; the middle of an active region. (deactivate-mark)) (or mouse-yank-at-point (mouse-set-point click)) (let ((primary (x-selection-value 'PRIMARY))) (if primary (insert primary) (error "No primary selection")))) (defun mouse-yank-secondary (click) "Insert the secondary selection at the position clicked on. Move point to the end of the inserted text. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (or mouse-yank-at-point (mouse-set-point click)) (let ((secondary (x-selection-value 'SECONDARY))) (if secondary (insert secondary) (error "No secondary selection"))))