X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/e5aaf3466bfbf7e981b3bdaa6b2588af3fefff41..169e69a3951d0d86bc2380e0187a01a6d35e3e25:/lisp/reposition.el diff --git a/lisp/reposition.el b/lisp/reposition.el index 9839c9afb6..e961d4e557 100644 --- a/lisp/reposition.el +++ b/lisp/reposition.el @@ -1,8 +1,9 @@ ;;; reposition.el --- center a Lisp function or comment on the screen -;; Copyright (C) 1991 Free Software Foundation, Inc. +;; Copyright (C) 1991, 1994 Free Software Foundation, Inc. ;; Author: Michael D. Ernst +;; Created: Jan 1991 ;; Maintainer: FSF ;; This file is part of GNU Emacs. @@ -23,8 +24,6 @@ ;;; Commentary: -;;; Written by Michael D. Ernst, mernst@theory.lcs.mit.edu, Jan 1991. - ;;; Reposition-window makes an entire function definition or comment visible, ;;; or, if it is already visible, places it at the top of the window; ;;; additional invocations toggle the visibility of comments preceding the @@ -71,13 +70,14 @@ first comment line visible (if point is in a comment)." (repos-count-screen-lines-signed ;; the beginning of the preceding comment (save-excursion - (forward-char 1) (end-of-defun -1) + (if (not (eobp)) (forward-char 1)) + (end-of-defun -1) ;; Skip whitespace, newlines, and form feeds. - (re-search-forward "[^\\s \n\014]") - (backward-char 1) + (if (re-search-forward "[^ \t\n\f]" nil t) + (backward-char 1)) (point)) here))) - (defun-height + (defun-height (repos-count-screen-lines-signed (save-excursion (end-of-defun 1) ; so comments associate with following defuns @@ -119,16 +119,16 @@ first comment line visible (if point is in a comment)." ;; whose first line is offscreen. ;; Avoid moving definition up even if defun runs offscreen; ;; we care more about getting the comment onscreen. - + (cond ((= line ht) ;; cursor on last screen line (and so in a comment) (if arg (progn (end-of-defun) (beginning-of-defun))) (recenter 0) ;;(repos-debug-macro "2a") ) - + ;; This condition, copied from case 4, may not be quite right - + ((and arg (< ht comment-height)) ;; Can't get first comment line onscreen. ;; Go there and try again. @@ -169,8 +169,7 @@ first comment line visible (if point is in a comment)." ;;(repos-debug-macro "4") )))) -;;;###autoload -(define-key esc-map "\C-l" 'reposition-window) +;;;###autoload (define-key esc-map "\C-l" 'reposition-window) ;;; Auxiliary functions