help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can header-line track a row in my file?


From: Lee
Subject: Re: Can header-line track a row in my file?
Date: 28 Oct 2002 12:11:27 -0800

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]