bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14694: 24.3; format-mode-line failing with :eval form via a variable


From: Eli Zaretskii
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 <address@hidden>
> 
>  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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]