Subject: Re: bug#1503: feature request: multiline header (and mode) lines

From: martin rudalics <[email-masked]>
Date: Sat, 06 Dec 2008 11:49:10 +0100

> Can emacs be given the gift of a header-line that word wraps, so that
 > the header can be more than one line tall?  I imagine the same could
 > go for the mode line, but I don't have a clear need for that right
 > now.  I know that the fringes can occupy > 1 column, so it seems like
 > an oversight if the header and mode lines are restricted to 1 line.
 >
 > I've written a minor mode for reading/sorting physics abstracts from
 > the physics arXiv.  The mode either lists subdirectories directly
 > under the current directory, or recursively lists all subdirectories
 > of the pwd.  Either way, the list could potentially be longer than the
 > width of the screen, making some directory names unviewable.  A
 > multiline header would make it perfect.
 >
 > I thought of putting that text in the buffer, but that makes it much
 > harder to update the text.

At the moment, we can't do that because the fact that a header-line
occupies exactly one line of text is hardwired into many lower-level
primitives.  In principle, what you want could be accomplished by the
routines below, but this will certainly have wrinkles (Emacs is not
really good at handling zero-length overlays).

martin

(defvar my-overlay (make-overlay (point-min) (point-min)))

(defun my-move (window start)
   (move-overlay my-overlay start start))

(add-hook 'window-scroll-functions 'my-move nil t)

(defun my-text (text)
   (overlay-put
    my-overlay 'before-string (propertize text 'face 'header-line)))

(my-text "a first line\nand another one\nand a third one\n")