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

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

Re: Is this correct?


From: Uday Reddy
Subject: Re: Is this correct?
Date: Sat, 26 Feb 2011 12:44:15 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 2/26/2011 6:54 AM, Tim X wrote:


(defun force-mode-line-update (&optional all)
   (if all (with-current-buffer (other-buffer)))
   (set-buffer-modified-p (buffer-modified-p)))

The bit that doesn't look quite right to me is

(if all (with-current-buffer (other-buffer)))

I'm assuming that by calling with-current-buffer, this will temporarily
make 'other-buffer' active and as a side effect, the mode-line etc will get
updated.

That would be quite magical if it were true. My guess is that the parentheses have been misplaced. It should have been

    (if all (with-current-buffer (other-buffer)
                (set-buffer-modified-p (buffer-modified-p)))
    (set-buffer-modified-p (buffer-modified-p))

This doesn't make it right of course. The "other-buffer" doesn't equate to "all" buffers, and pretty often, the "other-buffer" is an invisible buffer. It is not guaranteed that the current-buffer is a visible buffer either. So, this code would seem to be wrong at many levels!

Cheers,
Uday


reply via email to

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