unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Johan \"Bockgård\"'" <bojohan+news@dd.chalmers.se>,
	emacs-devel@gnu.org
Subject: RE: mode-line-format - local variableness
Date: Sun, 5 Apr 2009 16:37:18 -0700	[thread overview]
Message-ID: <004b01c9b647$75e428f0$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <004a01c9b646$5b15efa0$0200a8c0@us.oracle.com>

Summary (with no understanding of why, beyond the catechismic
don't-use-let-use-setq):

This will not work:

(defun foo (text &optional buffer)
  (with-current-buffer (or buffer (current-buffer))
    (let ((mode-line-format  text))
      (force-mode-line-update) (sit-for 2))
    (force-mode-line-update)))

This works (ugh!):

(defun foo (text &optional buffer)
  (with-current-buffer (or buffer (current-buffer))
    (let ((old-mode-line-format  mode-line-format))
      (setq mode-line-format  text)
      (force-mode-line-update) (sit-for 2)
      (setq mode-line-format  old-mode-line-format))
    (force-mode-line-update)))

Don't `let'-bind `mode-line-format', but you can `let'-bind something to its
value and then restore that later. Ugh!






  reply	other threads:[~2009-04-05 23:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-05 22:18 mode-line-format - local variableness Drew Adams
2009-04-05 22:50 ` Johan Bockgård
2009-04-05 23:24   ` Miles Bader
2009-04-05 23:29   ` Drew Adams
2009-04-05 23:37     ` Drew Adams [this message]
2009-04-06  0:50       ` Miles Bader
2009-04-06  3:05         ` Drew Adams
2009-04-06  1:37 ` Stefan Monnier
2009-04-06  3:19   ` Drew Adams
2009-04-06 13:30     ` Stefan Monnier
2009-04-06 21:37       ` Miles Bader

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004b01c9b647$75e428f0$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=bojohan+news@dd.chalmers.se \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).