all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 14694@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	[thread overview]
Message-ID: <83bo6wlufs.fsf@gnu.org> (raw)
In-Reply-To: <51C6839D.9070909@orcon.net.nz>

> Date: Sun, 23 Jun 2013 17:11:57 +1200
> From: Phil Sainty <psainty@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?





  reply	other threads:[~2013-06-23 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23  5:11 bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct Phil Sainty
2013-06-23 15:26 ` Eli Zaretskii [this message]
2013-06-23 16:45 ` Stefan Monnier
2013-06-23 17:48   ` Phil Sainty

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=83bo6wlufs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=14694@debbugs.gnu.org \
    --cc=psainty@orcon.net.nz \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.