home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!gumby!destroyer!ncar!sunny!southern
- From: southern@sunny.NoSubdomain.NoDomain (Lawrence Buja)
- Newsgroups: gnu.emacs.help
- Subject: Re: line numbers
- Message-ID: <1992Sep2.143710.28466@ncar.ucar.edu>
- Date: 2 Sep 92 14:37:10 GMT
- References: <9209020320.AA07133@midget.towson.edu>
- Sender: news@ncar.ucar.edu (USENET Maintenance)
- Reply-To: southern@ncar.ucar.edu
- Distribution: usa
- Organization: National Center for Atmospheric Research
- Lines: 62
-
- In article <9209020320.AA07133@midget.towson.edu>, tree@midget.towson.edu (Denise Tree) writes:
- >I know that Emacs is not a line type editor but I've been doing
- >a lot of patching lately and it would be helpful....
-
- I grabbed this off the net awhile ago and it works for me...
-
- ;;;
- ;;; newline.el
- ;;;
- ;;; This will set the line number in the mode line automatically when
- ;;; next-line,prev-line,scroll-up, and scroll down are called. It does
- ;;; not work to well with vm.
- ;;; Use the following commented out code for displaying the current column.
- ;;; Substitute it in the set-line function.
- ;;;
- ;;; (setq mode-line-process
- ;;; (format " %4d %4d" (1+ (count-lines 1 (point))) (current-column))))
-
-
- (defvar new-line-move-flag nil
- "*Nil if line numbering has not yet been defined.")
-
- (defun set-line ()
- (interactive)
- (setq mode-line-process
- ;;; (format " %4d" (1+ (count-lines 1 (point))))))
- (format " %4d %3d" (1+ (count-lines 1 (point))) (current-column))))
-
- ;;; Redefine new-line-move to include output of line number
-
- ;;; Use this for version 18.57 and beyond
- (defun new-line-move ()
- "*Enable line numbering."
- (fset 'old-line-move
- (symbol-function 'next-line-internal))
- (fset 'next-line-internal
- (function
- (lambda (arg)
- (old-line-move arg)
- (set-line))))
- )
-
- (if new-line-move-flag
- ()
- (setq new-line-move-flag t)
- (new-line-move))
-
-
- (defun new-scroll-up (&optional arg)
- (interactive "P")
- (scroll-up arg)
- (set-line))
-
- (defun new-scroll-down (&optional arg)
- (interactive "P")
- (scroll-down arg)
- (set-line))
-
-
- /\ Lawrence Buja Climate and Global Dynamics Division
- \_][ southern@ncar.ucar.edu National Center for Atmospheric Research
- \_________________________Boulder,_Colorado___80307-3000__________
-