home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / alt / lucidem / help / 689 < prev    next >
Encoding:
Text File  |  1992-11-13  |  2.0 KB  |  55 lines

  1. Path: sparky!uunet!spool.mu.edu!decwrl!pacbell.com!hoptoad!amdcad!amdahl!JUTS!climb!tlp00
  2. From: tlp00@climb.ras.amdahl.com (Tibor Polgar)
  3. Newsgroups: alt.lucid-emacs.help
  4. Subject: extra mode-motion+ function
  5. Message-ID: <01AD02zI2b0x01@JUTS.ccc.amdahl.com>
  6. Date: 13 Nov 92 04:35:59 GMT
  7. Sender: netnews@ccc.amdahl.com
  8. Reply-To: tlp00@climb.ras.amdahl.com
  9. Organization: Sun Microsystems
  10. Lines: 43
  11.  
  12. A while back Guido Bosch <bosch@loria.fr> posted a great addition to mode-motion 
  13. called mode-motion+.   Among the many enhancements to the standard were some mouseable
  14. functions to copy and delete/copy highlighed area.   Well what i felt was
  15. missing was a simple "delete" highlighted region... so here it is.  It is just a 
  16. simple snip of one of his existing routines.  Remember it won't run without his package.
  17.  
  18. -------------------------------------------------------------------------------------
  19. (defun x-set-point-cut-highlighted-text (event)
  20.   "Deletes highlighted region to point."
  21.   (interactive "e")
  22.   (let* ((point (event-point event))
  23.      (window (event-window event))
  24.      (buffer (and window (window-buffer window)))
  25.      (extent (and point buffer
  26.               (extent-at point buffer
  27.                  ;; 'highlight
  28.                  )))
  29.      (text (and extent
  30.             (save-window-excursion
  31.               (set-buffer buffer)
  32.               (prog1 
  33.               (buffer-substring
  34.                (extent-start-position extent)
  35.                (extent-end-position extent))
  36.             (kill-region
  37.              (extent-start-position extent)
  38.              (extent-end-position extent)))))))
  39.     )) 
  40.  
  41.  
  42. (global-set-key '(control meta button2) 'x-set-point-cut-highlighted-text)
  43.  
  44.  
  45. -------------------------------------------------------------------------------
  46. | Tibor L. Polgar    |  (408) 746-8649     | tlp00@climb.ras.amdahl.com
  47. | Amdahl Corporation
  48. | 1250 East Arques Avenue (M/S 281)
  49. | P.O. Box 3470
  50. | Sunnyvale, CA 94088-3470
  51. |
  52. | The opinions expressed above are mine, solely, and do not in any way
  53. | shape or form reflect the opinions or policies of Amdahl Corp.
  54. -------------------------------------------------------------------------------
  55.