home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / framing.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  2.9 KB  |  81 lines

  1. ;From ark1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!bbc Mon May 14 23:34:34 EDT 1990
  2. ;Article 1638 of gnu.emacs:
  3. ;Path: ark1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!bbc
  4. ;>From: bbc@rice.edu (Benjamin Chase)
  5. ;Newsgroups: gnu.emacs
  6. ;Subject: Re: line-to-top-of-window
  7. ;Message-ID: <BBC.90May9223629@sicilia.rice.edu>
  8. ;Date: 10 May 90 03:36:28 GMT
  9. ;References: <ROBERTS.90May9152931@studguppy.lanl.gov>
  10. ;Sender: root@rice.edu
  11. ;Reply-To: Benjamin Chase <bbc@rice.edu>
  12. ;Distribution: gnu
  13. ;Organization: Center for Research on Parallel Computations
  14. ;Lines: 64
  15. ;In-reply-to: roberts@studguppy.lanl.gov's message of 9 May 90 21:29:31 GMT
  16. ;
  17. ;roberts@studguppy.lanl.gov (Doug Roberts) writes:
  18. ;
  19. ;>There used to be a function of this name in release 18.54 & previous.
  20. ;>It would move (scroll) the line at the current cursor position to the
  21. ;>top of the window.
  22. ;>Does anybody know what it's replacement is?
  23. ;
  24. ;[Studguppy?]
  25. ;
  26. ;Yeah, here's some stuff I wrote when I first "went GNU".  I called the
  27. ;file "framing.el", although it may be more obvious to call it
  28. ;"point-to.el" or something like that.  I just wrote point-to-left and
  29. ;point-to-right tonight.  You may or may not agree with my choice of
  30. ;scroll amounts in those two functions.  Comments welcome...
  31. ;
  32. ;    Ben
  33.  
  34. ; Copyright (C) 1989 Benjamin B. Chase
  35. ; Permission is granted to copy, modify, and redistribute this
  36. ; software, but only under the conditions described in the
  37. ; GNU General Public License, Version 1, as published by the
  38. ; Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  39. ;
  40. ; This software is distributed without any warranty, and without any implied
  41. ; warranty of merchantibility or fitness.  See the GNU General Public License
  42. ; for more details.
  43.  
  44. ; framing.el
  45. ;
  46. ; History:
  47. ;    9 May 1990 Benjamin B. Chase <bbc@rice.edu>
  48. ;        Cleaned up my old code for posting to gnu.emacs, and added
  49. ;        point-to-left and point-to-right for completeness.
  50.  
  51. (provide 'point-to-top)
  52. (provide 'point-to-bottom)
  53.  
  54. (defun point-to-top ()
  55.   "Recenter the window so that point is on the top line."
  56.   (interactive)
  57.   (recenter 0))
  58.  
  59. (defun point-to-bottom ()
  60.   "Recenter the window so that point is on the bottom line."
  61.    (interactive)
  62.    (recenter -1))
  63.  
  64. (defun point-to-left ()
  65.   "Scroll the window so that point is at the left edge of the window."
  66.    (interactive)
  67.    (scroll-left (- (current-column) (window-hscroll))))
  68.  
  69. (defun point-to-right ()
  70.   "Scroll the window so that point is at the right edge of the window.
  71. If the window cannot be scrolled that far rightwards, scroll the window
  72. as far as possible.
  73. The character under cursor will be on the right edge of the
  74. screen, but obscured by the overstrike character (ie. '$')."
  75.    (interactive)
  76.    (scroll-right (- (window-width)
  77.             (- (current-column) (window-hscroll))
  78.             2)))
  79. ;--
  80. ;    Ben Chase <bbc@rice.edu>, Rice University, Houston, Texas
  81.