On , 15 May 1999, SL Baur wrote:
O.K. I'll put it in when you resubmit it. He probably also
changed
the point-at-[eb]ol stuff you had. Those functions have new horrible
name that I cannot remember.
It looks like RMS didn't change anything else than the file name (it
should be curline.el instead of current-line.el), so here it is:
;;; curline.el --- Display the current line with a distinctive face.
;; Author: Tudor Hulubei <tudor(a)gnu.org>
;; Maintainer: Tudor Hulubei <tudor(a)gnu.org>
;; Created: April 1999
;; Version: $Revision: 1.8 $
;; Keywords: current line
;; $Id: curline.el,v 1.8 1999/05/16 12:30:57 tudor Exp $
;; curline.el is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
;;
;; curline.el is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;; History:
;;; Commentary:
;;;
;;; In order to activate the `current-line' mode in the major modes
;;; defined in `current-line-major-modes' you would have to put the
;;; following code in your .emacs:
;;;
;;; (current-line-mode t)
;;;
;;; `current-line-major-modes' can be modified to include other modes
;;; as well. To deactivate the mode, execute (current-line-mode nil).
;;; Code:
(provide 'current-line)
(defgroup current-line nil
"Variables dealing with the display of the current line."
:group 'environment)
(defface current-line-face
'((((class color)) (:foreground "white" :background "blue")))
"Face used to highlight the current line."
:group 'current-line)
;;;###autoload
(defcustom current-line-major-modes
(list 'Buffer-menu-mode
'dired-mode
'compilation-mode
'vm-summary-mode
'rmail-summary-mode)
"A list of major modes in which the current line is displayed with a
distinctive face. Modify this as needed."
:group 'current-line)
;; Internal variables.
(defvar current-line-extent/overlay nil)
(make-variable-buffer-local 'current-line-extent/overlay)
;; Hide the difference between GNU Emacs (which uses overlays) and
;; XEmacs (which uses extents). XEmacs supports overlays too, maybe
;; it would be ok to use overlays for both Emacsen.
(defun clm-make-extent/overlay (begin end)
(if (fboundp 'make-extent)
(make-extent begin end)
(if (fboundp 'make-overlay)
(make-overlay begin end))))
(defun clm-set-extent/overlay-property (extent/overlay property value)
(if (fboundp 'make-extent)
(set-extent-property extent/overlay property value)
(if (fboundp 'make-overlay)
(overlay-put extent/overlay property value))))
(defun clm-set-extent/overlay-endpoints (extent/overlay begin end)
(if (fboundp 'make-extent)
(set-extent-endpoints extent/overlay begin end)
(if (fboundp 'make-overlay)
(move-overlay extent/overlay begin end))))
;;; GNU Emacs has different names for `point-at-bol' and
;;; `point-at-eol'.
(when (not (fboundp 'point-at-bol))
(defalias 'point-at-bol 'line-beginning-position))
(when (not (fboundp 'point-at-eol))
(defalias 'point-at-eol 'line-end-position))
(defun current-line-update ()
(when (member major-mode current-line-major-modes)
(unless current-line-extent/overlay
(setq current-line-extent/overlay (clm-make-extent/overlay 1 1))
(clm-set-extent/overlay-property current-line-extent/overlay
'face 'current-line-face)
(clm-set-extent/overlay-property current-line-extent/overlay
'priority 1))
(clm-set-extent/overlay-endpoints current-line-extent/overlay
(point-at-bol) (point-at-eol))))
;;;###autoload
(defun current-line-mode (arg)
"Display the current line with a distinctive face (current-line-face).
If ARG is nil, the appearance of the current line is not changed."
(interactive "P")
(if arg
(add-hook 'post-command-hook 'current-line-update)
(remove-hook 'post-command-hook 'current-line-update))
nil)
;;; curline.el ends here