Gnus development mailing list
 help / color / mirror / Atom feed
From: Russ Allbery <rra@stanford.edu>
Subject: message-mode modeline fiddling
Date: Wed, 02 Jan 2002 14:25:07 -0800	[thread overview]
Message-ID: <yln0zwo0fw.fsf@windlord.stanford.edu> (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/>



                 reply	other threads:[~2002-01-02 22:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yln0zwo0fw.fsf@windlord.stanford.edu \
    --to=rra@stanford.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).