all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonathan Goldblatt <jonathangoldblatt@yahoo.com>
To: Glenn Morris <rgm@gnu.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: Bug/Patch view.el
Date: Mon, 24 Sep 2007 07:35:22 -0400	[thread overview]
Message-ID: <18167.41210.803808.785862@tower.localdomain> (raw)
In-Reply-To: <69tzpmsfwg.fsf@fencepost.gnu.org>

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 <rgm@gnu.org> 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 "^.*$"))))




  reply	other threads:[~2007-09-24 11:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1t8x7bfyoe.fsf@totally-fudged-out-message-id>
2007-09-22 18:39 ` Bug/Patch view.el Glenn Morris
2007-09-24 11:35   ` Jonathan Goldblatt [this message]
2007-09-24 19:31     ` Glenn Morris
2007-09-25  2:30       ` Glenn Morris
2007-09-25  7:06         ` Glenn Morris
2007-09-12 19:52 Jonathan Goldblatt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18167.41210.803808.785862@tower.localdomain \
    --to=jonathangoldblatt@yahoo.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.