GNU bug report logs - #14694
24.3; format-mode-line failing with :eval form via a variable in a conditional construct

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Sun, 23 Jun 2013 05:13:01 UTC

Severity: normal

Tags: notabug

Found in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 14694 <at> debbugs.gnu.org
Subject: bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a	conditional construct
Date: Sun, 23 Jun 2013 18:26:31 +0300
> Date: Sun, 23 Jun 2013 17:11:57 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> 
>  From emacs -Q the following returns an empty string, which seems
> like a bug:
> 
> ELISP> (setq indirect-eval '(:eval "indirect eval"))
> ELISP> (format-mode-line '(t indirect-eval "else"))
> ""

It's not a bug.  The Lisp expressions supported in mode-line format
are those documented in the manual, and nothing else.  In particular,
the ':eval' part must appear explicitly, and any symbol stands for its
value (which is not eval'ed).

IOW, you seem to expect a full-blown Lisp evaluation there, but that
was never implemented or intended.

> And a related question, if I may: Other than wrapping advice around
> format-mode-line to let-bind a variable, is there any way for me to
> ascertain whether a mode line construct is being processed for an
> actual mode line redraw (in which case format-mode-line is not called),
> as opposed to some other situation (e.g. describe-mode) in which
> format-mode-line will be used?
> 
> My goal is to use the conditional construct to display the original
> value when calling format-mode-line, but an alternative value in the
> mode line itself, with the two values being stored in buffer local
> variables. At the moment I'm using advice to supply the condition
> (and of course I found the above bug when testing that my code worked
> for the different types of construct).

I don't understand: format-mode-line is a function you cannot change
or hook, so where exactly do you want to display a different value?
Both format-mode-line and the internal code that processes the mode
line format in the display engine access the same variable.

And anyway, why would you need format-mode-line to produce a different
value?




This bug report was last modified 11 years and 338 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.