From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67717 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: Make ietf-drums-remove-comments() robust against broken header Date: Fri, 31 Oct 2008 16:26:05 +0900 Organization: Emacsen advocacy group Message-ID: References: <87wsfqsgk7.fsf@tsuchiya.vaj.namazu.org> <87zlkm78nq.fsf@obelix.mork.no> <87prli5fb2.fsf@obelix.mork.no> <87iqra2lnt.fsf@tsuchiya.vaj.namazu.org> <87abclmwjf.fsf@tsuchiya.vaj.namazu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225438071 29282 80.91.229.12 (31 Oct 2008 07:27:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2008 07:27:51 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M16168@lists.math.uh.edu Fri Oct 31 08:28:53 2008 connect(): Connection refused Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1KvoRA-0001Jd-Dl for ding-account@gmane.org; Fri, 31 Oct 2008 08:28:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1KvoPF-0004zS-QQ; Fri, 31 Oct 2008 02:26:53 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1KvoPE-0004zC-Ho for ding@lists.math.uh.edu; Fri, 31 Oct 2008 02:26:52 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1KvoPB-0002BY-Bf for ding@lists.math.uh.edu; Fri, 31 Oct 2008 02:26:52 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1KvoPJ-0007gu-00 for ; Fri, 31 Oct 2008 08:26:57 +0100 Original-Received: from localhost ([127.0.0.1]:49393) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1KvoOX-0002xT-Sb for ding@gnus.org; Fri, 31 Oct 2008 02:26:10 -0500 X-Hashcash: 1:20:081031:ding@gnus.org::E5Ndjrwn5Fsk9lVL:0000BXoj X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:YYnZ6EVIDM4v6Pfs64qcVyBUclw= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67717 Archived-At: >>>>> 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,