[Top][All Lists]

[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: Phil Sainty
Subject: bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct
Date: Sun, 23 Jun 2013 17:11:57 +1200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

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"))

Other tests have worked as expected:

ELISP> (format-mode-line '(t "then" "else"))

ELISP> (setq indirect-string "indirect string")
ELISP> (format-mode-line '(t indirect-string "else"))
"indirect string"

ELISP> (format-mode-line '(:eval "direct eval"))
"direct eval"

ELISP> (format-mode-line '(t (:eval "direct eval") "else"))
"direct eval"

ELISP> (setq indirect-eval '(:eval "indirect eval"))
ELISP> (format-mode-line indirect-eval)
"indirect eval"

It just seems to be the combination of the (:eval) form as the value
of a variable in a conditional form which is failing.

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).


In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2013-06-23 on xerxes
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description:     Ubuntu 12.04.2 LTS

Important settings:
  value of $LANG: en_NZ.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x <up> r e p o r t - e m a <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
user-error: Beginning of history; no preceding item

Load-path shadows:
None found.

(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

reply via email to

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