From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hallvard B Furuseth Newsgroups: gmane.emacs.help Subject: Re: Checking for ASCII 7-bit Cleaness Date: Tue, 09 Jun 2009 20:53:33 +0200 Organization: University of Oslo, Norway Message-ID: References: <9068a652-b0f1-4f9c-81bb-7ce5676e82b5@o14g2000vbo.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1244587608 5792 80.91.229.12 (9 Jun 2009 22:46:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Jun 2009 22:46:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 10 00:46:45 2009 Return-path: Envelope-to: geh-help-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 1MEA5Z-0004uX-2c for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Jun 2009 00:46:41 +0200 Original-Received: from localhost ([127.0.0.1]:40124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEA5Y-0001t1-Ce for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Jun 2009 18:46:40 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!news.unit0.net!uio.no!nntp.uio.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Original-NNTP-Posting-Host: bombur.uio.no Original-X-Trace: readme.uio.no 1244573613 29803 129.240.6.233 (9 Jun 2009 18:53:33 GMT) Original-X-Complaints-To: abuse@uio.no Original-NNTP-Posting-Date: Tue, 9 Jun 2009 18:53:33 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:2Kf4S9VoMvgfQAKPxuEJwPDIXTY= Original-Xref: news.stanford.edu gnu.emacs.help:169867 X-Mailman-Approved-At: Tue, 09 Jun 2009 18:45:37 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65099 Archived-At: Nordlöw writes: > In C I would have stepped forward 4 bytes (except for the resting 1-3 > bytes of the file of course) and for each such block x then tested > that (x & 0x80808080) equals zero. If so the file is 7-bit clean. > Could we do something similar with elisp regular expression > operations? Don't think so. That's a C internals trick, abusing how integers and bytes are represented. (defun buffer-ascii-clean-p () (save-excursion (goto-char (point-min)) (skip-chars-forward "[\0-\177]") (eobp))) -- Hallvard