From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jonathan Goldblatt Newsgroups: gmane.emacs.bugs Subject: Re: Bug/Patch view.el Date: Mon, 24 Sep 2007 07:35:22 -0400 Message-ID: <18167.41210.803808.785862@tower.localdomain> References: <1t8x7bfyoe.fsf@totally-fudged-out-message-id> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1190633858 26997 80.91.229.12 (24 Sep 2007 11:37:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2007 11:37:38 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 24 13:37:32 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 1IZmFo-0003yx-Hg for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2007 13:37:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZmFl-00043o-QF for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2007 07:37:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZmDq-00014X-Lf for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 07:35:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZmDn-00010B-0F for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 07:35:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZmDm-0000zp-L3 for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 07:35:26 -0400 Original-Received: from smtp111.plus.mail.re1.yahoo.com ([69.147.102.74]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IZmDm-0003fs-5Q for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2007 07:35:26 -0400 Original-Received: (qmail 25250 invoked from network); 24 Sep 2007 11:35:25 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-YMail-OSG:Received:From:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID:Date:To:Cc:Subject:In-Reply-To:References; b=lJNQLKGQcHQuFlWnm2cNFfuj13JreiYuWCl0Iz+8+x3ndbg84zei+vqMM5lKrvF7RI0PV8yo5DCMRUB7itCZBNxHuEm9K3YM7GgVMT1pGzXHJr7siE9NoCtz7KdMIAOcZhHNLoNXkUOAzHVYbxAhlEu492gTaL5larf54TcXAAk= ; Original-Received: from unknown (HELO tower.localdomain) (pseudonymous6@76.160.64.172 with plain) by smtp111.plus.mail.re1.yahoo.com with SMTP; 24 Sep 2007 11:35:24 -0000 X-YMail-OSG: aDOJo4kVM1mP_qvNcgf3tZQCopEjDmAqlglmsAJjKPWbQn9RjltKZ8aqZqzaLX.uHYD1v6FhHg-- Original-Received: from jonathan by tower.localdomain with local (Exim 4.50) id 1IZmDj-0003PM-4G; Mon, 24 Sep 2007 07:35:23 -0400 In-Reply-To: <69tzpmsfwg.fsf@fencepost.gnu.org> X-Detected-Kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:16607 Archived-At: X-Mailer: VM 7.18 under Emacs 21.4.1 FCC: /server/home/jonathan/Mail/correspondance/correspondance.gz From: jonathangoldblatt@yahoo.com --text follows this line-- >>>>> "GM" == Glenn Morris writes: GM> Thanks for the detailed report. You're welcome. GM> Can't your version be simplified as follows? Your code is so much cleverer and exhibits so far a greater knowledge of elisp than mine that it doesn't seem appropriate to describe it as a simplification; I'd describe it as a greatly improved reimplementation of view-search-no-match-lines. However, it doesn't seem to test bobp in the place where it tests eobp, which would concern me, since the function searches both 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. I tested my implementation extensively enough that I'm convinced that it works in "more, possibly all, cases," and I find it much easier to test my own code than the code of others. It's possible that I will add the greater knowledge of elisp that I have gained by reading your code into what I wrote to preserve the investment that I have in testing, and add in comments to make it clearer; however, it seemed straightforward to me. Is there any real benefit to combining the loop over times with the loop looking for a non-matching line? I found that to be a confusing to me. I also found the short-circuiting of if tests by using conditionals a bit confusing, and have the same question about this practice. GM> I gave up trying to understand the original. Please forgive the obscurity of my code. I thank you for your comment. GM> (defun view-search-no-match-lines (times regexp) GM> (let ((fwd-one (if (< times 0) -1 1))) GM> (setq times (abs times)) GM> (while (and (> times 0) GM> (zerop (forward-line fwd-one))) GM> (if (eobp) GM> (setq times -1) GM> (or (re-search-forward regexp (line-end-position) t) GM> (setq times (1- times))))) GM> (and (zerop times) GM> (looking-at "^.*$"))))