home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / alt / lucidem / bug / 402 < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.1 KB  |  90 lines

  1. x-gateway: rodan.UU.NET from bug-lucid-emacs to alt.lucid-emacs.bug; Thu, 17 Dec 1992 08:00:56 EST
  2. Date: 17 Dec 1992 07:50:13 -0500
  3. From: els@sirius.hrb.com (Eric L. Schott)
  4. Subject: RE: x-set-point-and-insert-selection
  5. Message-ID: <9212171250.AA16434@sirius.hrb.com>
  6. Content-Transfer-Encoding: 7BIT
  7. References: <RJC.92Dec16180057@daiches.cogsci.ed.ac.uk>
  8. Newsgroups: alt.lucid-emacs.bug
  9. Path: sparky!uunet!wendy-fate.uu.net!bug-lucid-emacs
  10. Sender: bug-lucid-emacs-request@lucid.com
  11. Lines: 77
  12.  
  13. Richard Caley writes:
  14. > This seems to be broken in 19.3. I have it bound to the middle mouse
  15. > button.
  16. > What happens is that I select some text, then try and paste it using
  17. > the middle button somewhere else in the same buffer and the text
  18. > between the selection and the insertion point is insterted too. 
  19. > I think that that x-set-point-and-insert-selection is setting the
  20. > point before looking at the selection and the set-point it is using is
  21. > one which extends the selection. 
  22.  
  23. Jamie mailed a fix to this to me.  The patch is below.
  24.  
  25. *** x-mouse.el.dist    Fri Sep  4 05:43:01 1992
  26. --- x-mouse.el    Fri Sep 18 07:52:54 1992
  27. ***************
  28. *** 32,59 ****
  29.       (let ((s (buffer-substring old-point (point))))
  30.         (x-own-clipboard s)
  31.         (x-store-cutbuffer s))
  32.       (kill-region old-point (point))))
  33.   
  34. ! (defun x-insert-selection (&optional check-cutbuffer-p)
  35.     "Insert the current selection into buffer at point."
  36.     (interactive)
  37.     (let ((text (if check-cutbuffer-p
  38.             (or (condition-case () (x-get-selection) (error ()))
  39.                 (x-get-cutbuffer)
  40.                 (error "No selection or cut buffer available"))
  41.           (x-get-selection))))
  42.       (push-mark (point))
  43.       (insert text)
  44.   ;;    (if zmacs-regions (zmacs-activate-region))
  45.       ))
  46.   
  47.   (defun x-set-point-and-insert-selection (event)
  48.     "Sets point where clicked and insert the primary selection or the cut buffer"
  49.     (interactive "e")
  50. !   (mouse-set-point event)
  51. !   (x-insert-selection t))
  52.   
  53.   (defun mouse-track-and-copy-to-cutbuffer (event)
  54.     "Makes a selection like `mouse-track', but also copies it to the cutbuffer."
  55.     (interactive "e")
  56.     (mouse-track event)
  57. --- 32,59 ----
  58.       (let ((s (buffer-substring old-point (point))))
  59.         (x-own-clipboard s)
  60.         (x-store-cutbuffer s))
  61.       (kill-region old-point (point))))
  62.   
  63. ! (defun x-insert-selection (&optional check-cutbuffer-p move-point-p)
  64.     "Insert the current selection into buffer at point."
  65.     (interactive)
  66.     (let ((text (if check-cutbuffer-p
  67.             (or (condition-case () (x-get-selection) (error ()))
  68.                 (x-get-cutbuffer)
  69.                 (error "No selection or cut buffer available"))
  70.           (x-get-selection))))
  71. +     (if move-point-p (mouse-set-point event))
  72.       (push-mark (point))
  73.       (insert text)
  74.   ;;    (if zmacs-regions (zmacs-activate-region))
  75.       ))
  76.   
  77.   (defun x-set-point-and-insert-selection (event)
  78.     "Sets point where clicked and insert the primary selection or the cut buffer"
  79.     (interactive "e")
  80. !   (x-insert-selection t t))
  81.   
  82.   (defun mouse-track-and-copy-to-cutbuffer (event)
  83.     "Makes a selection like `mouse-track', but also copies it to the cutbuffer."
  84.     (interactive "e")
  85.     (mouse-track event)
  86.  
  87.