Gnus development mailing list
 help / color / mirror / Atom feed
* message-mode modeline fiddling
@ 2002-01-02 22:25 Russ Allbery
  0 siblings, 0 replies; only message in thread
From: Russ Allbery @ 2002-01-02 22:25 UTC (permalink / raw)


I came up with this after a couple of hours of experimentation, and
figured I'd pass it along in case anyone else had the same problem.  The
comment should explain the idea.

;; I really want to be able to see the percentage through the buffer when I'm
;; writing mail (particularly handy for responding to long messages).  There
;; are two things conspiring against this:  message mode tends to use long
;; buffer names and there's no limit on the length of the buffer name
;; displayed by default, and message mode comes with a whole mess of minor
;; modes that fill up the mode line.  This function does some dark and evil
;; fiddling with modeline-format to wrap a length constraint around the buffer
;; name and remove the minor mode list from the format.  It *should* be robust
;; against future changes to modeline-format, I hope.
(add-hook 'message-mode-hook 'rra-message-fix-modeline)
(defun rra-message-fix-modeline ()
  "Tweak modeline-format to put a length limit on the buffer name portion of
it and remove the minor mode list, in an effort to reduce the length of the
mode line so that the percentage location in the buffer is always visible."
  (let ((frame (car (cdr (reverse modeline-buffer-identification))))
        (buffer (car (reverse modeline-buffer-identification))))
    (setq modeline-buffer-identification (list -40 "" frame buffer)))
  (setq modeline-format
        (mapcar (lambda (element)
                  (if (and (listp element) (listp (cdr element)))
                      (remove 'minor-mode-alist element)
                    element))
                modeline-format)))

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-02 22:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-02 22:25 message-mode modeline fiddling Russ Allbery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).