all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cecil Westerhof <Cecil@decebal.nl>
To: help-gnu-emacs@gnu.org
Subject: Re: How to update modelines of all displayed buffers
Date: Fri, 16 Apr 2010 09:19:16 +0200	[thread overview]
Message-ID: <87fx2vvp8r.fsf@linux-lqcw.site> (raw)
In-Reply-To: barmar-A88AB4.22171615042010@news.eternal-september.org

Barry Margolin <barmar@alum.mit.edu> writes:

>> 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?

Yes, my bad:
    (unless (memq 'buffer-mode-line global-mode-string)
      (setq global-mode-string
        (append global-mode-string 
            '("" buffer-mode-line))))


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

This does all buffers. Is it possible to do it only for displayed
buffers?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


  reply	other threads:[~2010-04-16  7:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 19:21 How to update modelines of all displayed buffers Cecil Westerhof
2010-04-16  2:17 ` Barry Margolin
2010-04-16  7:19   ` Cecil Westerhof [this message]
2010-04-16 21:58     ` José A. Romero L.
2010-04-16 22:49 ` Andreas Politz

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=87fx2vvp8r.fsf@linux-lqcw.site \
    --to=cecil@decebal.nl \
    --cc=help-gnu-emacs@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 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.