Subject: bug#4217: 23.1; probable mode-line bug

From: Eli Barzilay <[email-masked]>
Date: Tue, 25 Aug 2009 13:29:06 -0400

On Aug 25, Glenn Morris wrote:
> Eli Barzilay wrote:
> 
> > I thought that having them at the front makes more sense -- due to the
> > following "-%-".
> 
> I assumed the actual problem you wanted to report was that in:
> 
> emacs -Q -f which-func-mode --eval '(setq global-mode-string "foo")' lisp/startup.el
> 
> there are 4 "-" characters between which-func's '[...]' and the
> global-mode-string.

Yes, that's the result of the bad placement of dashes.

> Since mode-line-modes already ends in "--", moving the dashes to the
> front of which-func will just shift the 4 "-" around rather than
> reducing them to 2.

I missed this, mostly because I just looked at the code that *looked*
like it has a problem.  Anyway, in this case the obvious solution is
to remove the last two dashes from `mode-line-modes'.  This means that
the relevant code:

	 (propertize "  " 'help-echo help-echo)
	 'mode-line-modes
	 `(which-func-mode ("" which-func-format ,dashes))
	 `(global-mode-string (,dashes global-mode-string))
	 (propertize "-%-" 'help-echo help-echo)

works fine in all cases.

> Although the "--" at the end of the global-mode-string entry are not
> necessary (being followed by -%-), I think it makes sense to have
> all the entries be the same, so that entries can be
> removed/added/reordered easily.

Yes, having all entries be the same is definitely the answer -- but
this should apply to everything except for the first or the last in
the chain (depending on using the dashes before/after), and
moving the dashes to the front and making `mode-line-modes' not end
with dashes seems to me as a better choice.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!