home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / emacs / sources / 557 < prev    next >
Encoding:
Text File  |  1992-07-28  |  3.5 KB  |  103 lines

  1. Newsgroups: gnu.emacs.sources
  2. Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!times!wmesard
  3. From: wmesard@Pescadero.Stanford.EDU (Wayne Mesard)
  4. Subject: wsm-xm-clip: another x-sb-mouse customization
  5. Message-ID: <WMESARD.92Jul28174430@Pescadero.Stanford.EDU>
  6. Sender: news@CSD-NewsHost.Stanford.EDU
  7. Reply-To: wmesard@cs.stanford.edu
  8. Organization: /pescadero/u3/wmesard/.organization
  9. Date: 28 Jul 92 17:44:30
  10. Lines: 91
  11.  
  12. Here's a small customization that modifies the way a couple of cutting
  13. and pasting functions work in x-sb-mouse so that the behavior is more
  14. consistent with cutting and pasting in Xterm windows.  (X-sb-mouse's
  15. goal was to be backwards compatible with alt-mouse, but my fingers are
  16. too stupid to remember two sets of mouse gestures.)
  17.  
  18. See the DESCRIPTION section for details.
  19.  
  20. Wayne();
  21. WMesard@cs.stanford.edu
  22.  
  23. P.S. X-sb-mouse is available from the archive (archive.cis.ohio-state.edu) 
  24. in /pub/gnu/emacs/elisp-archive/misc/x-sb-mouse.tar.Z.
  25.  
  26. ----snoop---croockle---poop----
  27. ;;; wsm-xm-clip.el: WSM's cutting/copying customizations for x-sb-mouse
  28. ;;; Copyright (C) 1992 Wayne Mesard
  29. ;;;
  30. ;;; This program is free software; you can redistribute it and/or modify
  31. ;;; it under the terms of the GNU General Public License as published by
  32. ;;; the Free Software Foundation; either version 1, or (at your option)
  33. ;;; any later version.
  34. ;;;
  35. ;;; This program is distributed in the hope that it will be useful,
  36. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  37. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  38. ;;; GNU General Public License for more details.
  39. ;;;
  40. ;;; The GNU General Public License is available by anonymouse ftp from
  41. ;;; prep.ai.mit.edu in pub/gnu/COPYING.  Alternately, you can write to
  42. ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  43. ;;; USA.
  44. ;;--------------------------------------------------------------------
  45.  
  46. ;;; DESCRIPTION
  47. ;;    Make cutting and pasting behave more like it does in xterms (my poor
  48. ;;    mouse-hand can only remember one set of bindings):
  49. ;;
  50. ;;     * Right-click copies everything between point and the mouse location.
  51. ;;
  52. ;;     * Middle-click inserts the cut-buffer _at_point_ in _active_buffer_
  53. ;;       (Instead of at mouse-point (like x-sb-paste-text) and instead of
  54. ;;       at point in the buffer under the mouse (like x-mouse-paste-there).)
  55. ;;       Also, moves the point to the end of the inserted text .
  56. ;;
  57. ;;       The vanilla X-sb-mouse functions are still available (since
  58. ;;       they're bound to multiple gestures by default):
  59. ;;
  60. ;;         * x-mouse-paste-text  is on Control-middle-click.
  61. ;;         * x-mouse-paste-there is on Shift-right-click
  62. ;;
  63. ;;    Wayne Mesard: wmesard@cs.stanford.edu
  64.  
  65.  
  66. ;;; HISTORY
  67. ;;    1.0 wmesard - Jul 16, 1992: Created
  68.  
  69. ;;;
  70. ;;; DEPENDENCIES
  71. ;;;
  72.  
  73. ;; x-sb-mouse version 1.6
  74. (require 'x-sb-mouse)
  75.  
  76. ;;; 
  77. ;;; BINDINGS
  78. ;;; 
  79.  
  80. (x-mouse-define-key "x-mouse-3-window-click" t
  81.  'default 'wsm-x-mouse-copy-region-to-x)
  82. (x-mouse-define-key "x-mouse-2-window-click" t
  83.  'default 'wsm-x-mouse-paste-there)
  84.  
  85. ;;; 
  86. ;;; PUBLIC FUNCTIONS
  87. ;;; 
  88.  
  89. (defun wsm-x-mouse-copy-region-to-x ()
  90.   "Copies the text between point and mouse point to the X cut-buffer."
  91.   (set-buffer (window-buffer x-mouse-win-u))
  92.   (x-store-cut-buffer (buffer-substring x-mouse-point-u (point)))
  93.   )
  94.  
  95. (defun wsm-x-mouse-paste-there ()
  96.   "Like x-mouse-paste-there, except that it pastes the X cut buffer at the
  97. point of the _active_ buffer, not the buffer being pointed to.  Also, it 
  98. moves the point to the end of the inserted text."
  99.   (insert (x-get-cut-buffer)))
  100.  
  101.  
  102.  
  103.