Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: Make ietf-drums-remove-comments() robust against broken header
Date: Fri, 31 Oct 2008 16:26:05 +0900	[thread overview]
Message-ID: <b4mtzatns36.fsf@jpl.org> (raw)
In-Reply-To: <m2k5bpe9ic.fsf@lifelogs.com>

>>>>> Ted Zlatanov wrote:
> Because this was breaking my split methods and thus my entire Gnus
> startup (because I use gnus-registry-split-fancy-with-parent), I took
> the liberty of installing the change.  In addition, I put in an extra
> condition-case to prevent any other such problems, assuming that at
> worst we'd have bad references due to parsing bugs.

> If this is not OK, please put in whatever changes you think are
> appropriate, as long as they don't bring the bug back :)

If the purpose of the extra `condition-case' you added is for
another `forward-sexp', isn't it better to be the following for
making the code easy to see?

--8<---------------cut here---------------start------------->8---
(defun ietf-drums-remove-comments (string)
  "Remove comments from STRING."
  (with-temp-buffer
    (let (c)
      (ietf-drums-init string)
      (while (not (eobp))
	(setq c (char-after))
	(cond
	 ((eq c ?\")
	  (condition-case nil
	      (forward-sexp 1)
	    (goto-char (point-max))))
	 ((eq c ?\()
	  (delete-region
	   (point)
	   (condition-case nil
	       (with-syntax-table (copy-syntax-table ietf-drums-syntax-table)
		 (modify-syntax-entry ?\" "w")
		 (forward-sexp 1)
		 (point))
	     (error (point-max)))))
	 (t
	  (forward-char 1))))
      (buffer-string))))
--8<---------------cut here---------------end--------------->8---

BTW, I tried the benchmark and verified that TSUCHIYA-san's change
does not slow Gnus.

Regards,



  reply	other threads:[~2008-10-31  7:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30  7:11 TSUCHIYA Masatoshi
2008-10-30  8:54 ` Katsumi Yamaoka
2008-10-30  9:07 ` Bjørn Mork
2008-10-30  9:25   ` Katsumi Yamaoka
2008-10-30 14:27     ` Bjørn Mork
2008-10-30 14:38       ` TSUCHIYA Masatoshi
2008-10-30 23:33         ` Katsumi Yamaoka
2008-10-31  0:35           ` TSUCHIYA Masatoshi
2008-10-31  1:21             ` Katsumi Yamaoka
2008-10-31  3:19               ` Ted Zlatanov
2008-10-31  7:26                 ` Katsumi Yamaoka [this message]
2008-10-31  9:06                   ` Katsumi Yamaoka
2008-10-31 17:34                     ` Ted Zlatanov

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=b4mtzatns36.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).