From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: Re: Bug/Patch view.el Date: Mon, 24 Sep 2007 15:31:06 -0400 Message-ID: References: <1t8x7bfyoe.fsf@totally-fudged-out-message-id> <18167.41210.803808.785862@tower.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1190662322 31731 80.91.229.12 (24 Sep 2007 19:32:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2007 19:32:02 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Jonathan Goldblatt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 24 21:31:57 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IZter-0007zq-D6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2007 21:31:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZteo-00067o-Ak for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2007 15:31:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZtem-00067j-W8 for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 15:31:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZtel-00067M-Io for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 15:31:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZtel-00067J-G3 for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 15:31:47 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IZtel-000597-6B for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 15:31:47 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1IZte6-0006ek-KJ; Mon, 24 Sep 2007 15:31:06 -0400 X-Spook: MD2 freedom Kosovo enigma Nazi Compsec investigation X-Ran: QRZwsOFl$f=o|L8N$Q.Or0X=z9uoetcgFEcUsna*2sKy!04L2.fKI(HgS`@1K&8:D?,e'` X-Hue: white X-Attribution: GM In-Reply-To: <18167.41210.803808.785862@tower.localdomain> (Jonathan Goldblatt's message of "Mon, 24 Sep 2007 07:35:22 -0400") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16611 Archived-At: 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...