11

How can I make Emacs always display the first line of a file which contains header information (such as a CSV) as I scroll down past where it would usually no longer be visible?

wdkrnls
  • 3,657
  • 2
  • 27
  • 46
  • Making a new window just for the header line would work, except that often the number of columns in a csv is so large that it scrolls past the screen. – wdkrnls Jan 26 '15 at 20:32

2 Answers2

13

Make it a header line.

A window can have a header line at the top. It does not scroll out of the window, but remains displayed at the top. I guess that's what you are asking for.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • @wdkrnls If you use the [sx.el](https://github.com/vermiculus/sx.el/) package, you will notice they the key board shortcuts display on the top of the buffer is implemented using `header-line-format`: `(" " (:propertize "n p TAB" face mode-line-buffer-id) ": Navigate" " " (:propertize "u d" face mode-line-buffer-id) ": Up/Down Vote" " " (:propertize "c" face mode-line-buffer-id) ": Comment" " " (:propertize "a" face mode-line-buffer-id) ": Answer" " " (:propertize "e" face mode-line-buffer-id) ": Edit" " " (:propertize "q" face mode-line-buffer-id) ": Quit")`. – Kaushal Modi Jan 26 '15 at 17:23
  • `header-line-format` looks promising, but it doesn't really integrate well with `csv-mode` and especially with the `csv-align-fields` function. Even if it could, it doesn't hide the first line. – wdkrnls Jan 26 '15 at 19:17
  • 1
    I wish there was a `tabular-data-mode` that read in text delimited data as an user editable form of `tabulated-list-mode`, which probably also uses the `header line` feature. – wdkrnls Jan 26 '15 at 19:20
1

You could also split the window. C-u 1 C-x 2

user27815
  • 239
  • 1
  • 6