diff lisp/mouse.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children da8ed4261e83
line wrap: on
line diff
--- a/lisp/mouse.el	Mon Aug 13 11:19:22 2007 +0200
+++ b/lisp/mouse.el	Mon Aug 13 11:20:41 2007 +0200
@@ -84,54 +84,11 @@
   "Function that is called upon by `mouse-yank' to actually insert text.")
 
 (defun mouse-consolidated-yank ()
-  "Insert the current selection or, if there is none under X insert
-the X cutbuffer.  A mark is pushed, so that the inserted text lies
-between point and mark."
   (interactive)
-  (if (and (not (console-on-window-system-p))
-	   (and (featurep 'gpm)
-		(not gpm-minor-mode)))
-      (yank)
-    (push-mark)
-    (if (region-active-p)
-	(if (consp zmacs-region-extent)
-	    ;; pirated code from insert-rectangle in rect.el
-	    ;; perhaps that code should be modified to handle a list of extents
-	    ;; as the rectangle to be inserted?
-	    (let ((lines zmacs-region-extent)
-		  (insertcolumn (current-column))
-		  (first t))
-	      (push-mark)
-	      (while lines
-		(or first
-		    (progn
-		      (forward-line 1)
-		      (or (bolp) (insert ?\n))
-		      (move-to-column insertcolumn t)))
-		(setq first nil)
-		(insert (extent-string (car lines)))
-		(setq lines (cdr lines))))
-	  (insert (extent-string zmacs-region-extent)))
-      (insert-selection t))))
-
-(defun insert-selection (&optional check-cutbuffer-p move-point-event)
-  "Insert the current selection into buffer at point."
-  (interactive "P")
-  ;; we fallback to the clipboard if the current selection is not existent
-  (let ((text (if check-cutbuffer-p
-		  (or (get-selection-no-error) 
-		      (get-cutbuffer)
-		      (get-selection-no-error 'CLIPBOARD)
-		      (error "No selection, clipboard or cut buffer available"))
-		(or (get-selection-no-error)
-		    (get-selection 'CLIPBOARD)))))
-    (cond (move-point-event
-	   (mouse-set-point move-point-event)
-	   (push-mark (point)))
-	  ((interactive-p)
-	   (push-mark (point))))
-    (insert text)
-    ))
+  (case (device-type)
+    (x (x-yank-function))
+    (tty (yank))
+    (otherwise (yank))))
 
 
 (defun mouse-select ()
@@ -228,10 +185,9 @@
   (if (click-inside-extent-p event zmacs-region-extent)
       ;; okay, this is a drag
       (cond ((featurep 'offix)
-	     (offix-start-drag-region 
-	      event
-	      (extent-start-position zmacs-region-extent)
-	      (extent-end-position zmacs-region-extent)))
+	     (offix-start-drag-region event
+				      (extent-start-position zmacs-region-extent)
+				      (extent-end-position zmacs-region-extent)))
 	    ((featurep 'cde)
 	     ;; should also work with CDE
 	     (cde-start-drag-region event
@@ -1383,7 +1339,7 @@
 	 ;; vars is a list of glyph variables to check for a pointer
 	 ;; value.
 	 (vars (cond
-		;; Checking if button is non-nil is not sufficient
+		;; Checking if button is non-nil is not sufficent
 		;; since the pointer could be over a blank portion
 		;; of the toolbar.
 		((event-over-toolbar-p event)
@@ -1525,10 +1481,10 @@
 		 (setq last-timestamp (event-timestamp event))
 		 ;; Enlarge the window, calculating change in characters
 		 ;; of default font. Do not let the window to become
-		 ;; less than allowed minimum (not because that's critical
+		 ;; less than alolwed minimum (not because that's critical
 		 ;; for the code performance, just the visual effect is
 		 ;; better: when cursor goes to the left of the next left
-		 ;; divider, the window being resized shrinks to minimal
+		 ;; divider, the vindow being resized shrinks to minimal
 		 ;; size.
 		 (enlarge-window (max (- window-min-width (window-width window))
 				      (/ (- (event-x-pixel event) old-right)
@@ -1538,7 +1494,7 @@
 		 ;; if the change caused more than two windows to resize
 		 ;; (shifting the whole stack right is ugly), or if the
 		 ;; left window side has slipped (right side cannot be
-		 ;; moved any further to the right, so enlarge-window
+		 ;; moved any funrther to the right, so enlarge-window
 		 ;; plays bad games with the left edge.
 		 (if (or (/= (count-windows) (length old-edges-all-windows))
 			 (/= old-left (car (window-pixel-edges window)))