10

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?

  • 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
12

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.

  • @wdkrnls If you use the 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.