From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: mus5mk2ly001@sneakemail.com (Lee) Newsgroups: gmane.emacs.help Subject: Re: Can header-line track a row in my file? Date: 28 Oct 2002 12:11:27 -0800 Organization: http://groups.google.com/ Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <5lpttyz0ux.fsf@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1035836181 17805 80.91.224.249 (28 Oct 2002 20:16:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 28 Oct 2002 20:16:21 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 186GJ5-0004cG-00 for ; Mon, 28 Oct 2002 21:16:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 186GJI-0000DA-00; Mon, 28 Oct 2002 15:16:28 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: 12.13.238.140 Original-X-Trace: posting.google.com 1035835887 1298 127.0.0.1 (28 Oct 2002 20:11:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 28 Oct 2002 20:11:27 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:106463 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3013 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3013 And at last, here is the final version (I hope). I found that having tabs would sometimes offset the header and I have also unhardcoded the line number. You can just put the cursor on the line you want displayed in the header and then do M-x my-set-header-line-format: (defun my-set-header-line-format () (interactive) (set (make-local-variable 'my-line-number) (save-restriction (widen) (save-excursion (beginning-of-line) (1+ (count-lines 1 (point)))))) (set (make-local-variable 'header-line-format) '(" " (:eval (save-excursion (goto-line my-line-number) (move-to-column (window-hscroll)) (untabify (point) (line-end-position)) (buffer-substring (point) (line-end-position))))))) Lee