From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: Byte offset from point Date: Wed, 12 Aug 2009 22:18:42 +0300 Organization: A noiseless patient Spider Message-ID: <87tz0cu9gt.fsf@iki.fi> References: <87y6pouagb.fsf@iki.fi> <2c08d46a-482d-4c99-b815-f06a97f6e9de@d4g2000yqa.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 1250106279 7691 80.91.229.12 (12 Aug 2009 19:44:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2009 19:44:39 +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 Aug 12 21:44:32 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 1MbJkN-000147-Cp for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2009 21:44:31 +0200 Original-Received: from localhost ([127.0.0.1]:44611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbJkK-00034a-Rf for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2009 15:44:29 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 14 Original-X-Trace: news.eternal-september.org U2FsdGVkX1+rbZg5zJ1dV+36Qo/s/Ufk4I9G5QYPvUfMo/SftDHJVcp701zY2Z46hdKSj/4ESVccb6TpnUNAlOevA11psqNt9JUOFT3bqYqslrUjd4j0mOs2y9Po6W14dxNmgD0OWfd5Kq37a7vGFw== Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Wed, 12 Aug 2009 19:27:03 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19ab0twQsCzZ66xJWSBqVI02hhB1OySowjAGzYXmGJ8MQ== Cancel-Lock: sha1:OHYuKI03aCGv/2QZTI2ulbhbQB0= sha1:rMuASb3b7DHHdy+g71gMRCfgQxA= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:171923 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:67098 Archived-At: On 2009-08-12 12:06 (-0700), senny wrote: > On 12 Aug., 20:57, Teemu Likonen wrote: >>     (position-bytes (point)) > > I tried that but it gave me incorrect results when dealing with > newlines on windows. The lisp function counted them as 1 byte but the > service i was calling counted them as 2 bytes. Maybe you can do the correction manually. Count newlines twice: (+ (position-bytes (point)) (how-many "\n" 1 (point))) Or something like that.