[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug/Patch view.el
From: |
Glenn Morris |
Subject: |
Re: Bug/Patch view.el |
Date: |
Mon, 24 Sep 2007 15:31:06 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Jonathan Goldblatt wrote:
> However, it doesn't seem to test bobp in the place where it tests
> eobp
There's no need. forward-line returns a non-zero value on reaching the
start of the buffer. It does at the end too, but with a slight
difference, as noted in the doc string:
With positive N, a non-empty line at the end counts as one line
successfully moved (for the return value).
Basically (forward-line -1) called anywhere on the first line in a
buffer returns non-zero. (forward-line 1) called on the last line,
before the end, moves you to eob and returns 0. Hence the need for an
extra eobp test to avoid a meaningless search and a false match.
> forward and backward and it also doesn't seem to be concerned with
> its return value which would also be a source of concern to me, as I
> believe the caller uses the value.
It returns the same value as the original: nil/t for failure/success.
> Is there any real benefit to combining the loop over times with the
> loop looking for a non-matching line?
Efficiency.
> I also found the short-circuiting of if tests by using conditionals
> a bit confusing, and have the same question about this practice.
Just personal preference, I think.
> GM> I gave up trying to understand the original.
>
> Please forgive the obscurity of my code.
I actually meant the original version in the file, not your version!
Sorry. The original looked like it was trying to do something clever,
but I couldn't figure it out...