From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/41455 Path: main.gmane.org!not-for-mail From: Russ Allbery Newsgroups: gmane.emacs.gnus.general Subject: message-mode modeline fiddling Date: Wed, 02 Jan 2002 14:25:07 -0800 Organization: The Eyrie Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035176847 6226 80.91.224.250 (21 Oct 2002 05:07:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 05:07:27 +0000 (UTC) Return-Path: Original-Received: (qmail 4614 invoked from network); 2 Jan 2002 22:25:59 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 2 Jan 2002 22:25:59 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16LtpB-0008ML-00; Wed, 02 Jan 2002 16:25:29 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 02 Jan 2002 16:25:22 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id QAA26336 for ; Wed, 2 Jan 2002 16:25:13 -0600 (CST) Original-Received: (qmail 4583 invoked by alias); 2 Jan 2002 22:25:15 -0000 Original-Received: (qmail 4578 invoked from network); 2 Jan 2002 22:25:14 -0000 Original-Received: from windlord.stanford.edu (171.64.13.23) by gnus.org with SMTP; 2 Jan 2002 22:25:14 -0000 Original-Received: (qmail 24328 invoked by uid 50); 2 Jan 2002 22:25:07 -0000 Original-To: ding@gnus.org Original-Lines: 30 User-Agent: Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.4 (Common Lisp, sparc-sun-solaris2.6) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:41455 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:41455 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)