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

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

Re: How to update modelines of all displayed buffers


From: Barry Margolin
Subject: Re: How to update modelines of all displayed buffers
Date: Tue, 04 May 2010 15:44:41 -0000
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <87y6gor07c.fsf@linux-lqcw.site>,
 Cecil Westerhof <Cecil@decebal.nl> wrote:

> I have defined the following function:
>     (defun buffer-update-mode-line ()
>       (setq buffer-mode-line (buffer-mode-line-extra))
>       (force-mode-line-update t))
> 
> The function buffer-mode-line-extra gives the extra data I want to
> display in the modeline.

What's the variable buffer-mode-line?  I can't find it in the Emacs Lisp 
documentation, is it something you added?

> 
> It is called every minute with:
>     (run-with-timer 60 60 'buffer-update-mode-line)
> 
> With this only the modeline of the current buffer is updated. In
> principal (force-mode-line-update t) makes all modelines updated, but
> that will only work if for every (visible) buffer buffer-mode-line is
> updated with the function buffer-mode-line-extra. Is there a way to get
> this done?

If buffer-mode-line is a buffer-local variable, you need to loop through 
all buffers, changing to each one and running your function.

(defun update-mode-line-all-buffers ()
  (save-current-buffer
    (dolist (b (buffer-list))
      (set-buffer b)
      (buffer-update-mode-line))))

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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