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

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

Re: Is this correct?


From: Eli Zaretskii
Subject: Re: Is this correct?
Date: Sat, 26 Feb 2011 16:07:26 +0200

> Date: Sat, 26 Feb 2011 12:44:15 +0000
> From: Uday Reddy <uDOTsDOTreddy@cs.bham.ac.uk>
> 
> 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.

????? Doesn't force-mode-line-update work for you?

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

I gets better: `(set-buffer-modified-p (buffer-modified-p))'
apparently does nothing, because it sets the buffer's modified flag to
the same value it has already.  So this function actually does nothing
at all, right?



reply via email to

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