From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner Newsgroups: gmane.emacs.devel Subject: Re: How to get buffer byte length (not number of characters)? Date: Sun, 25 Aug 2024 23:37:49 -0700 Message-ID: <87mskz7ps2.fsf@ushin.org> References: <87wmkbekjp.fsf@ushin.org> <86o75nwilg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30345"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 26 13:02:09 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1siXU8-0007gb-1G for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Aug 2024 13:02:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1siXTP-0005l4-0N; Mon, 26 Aug 2024 07:01:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siTMj-00065A-Nb for emacs-devel@gnu.org; Mon, 26 Aug 2024 02:38:13 -0400 Original-Received: from out-170.mta0.migadu.com ([91.218.175.170]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siTMi-0000U2-71 for emacs-devel@gnu.org; Mon, 26 Aug 2024 02:38:13 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1724654277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FRDyMHOIc+5o3iP0RuToGpP3JwLunmGU9V2u+/uZSSQ=; b=H5Bborq/vnAYBEpGY7GRhP6Xfou8c3FmHQjv0zr5CvDyfbxyCo0oh+Qg1VO03obnYnLPi3 dOOdPU48WlMDf+U19yDsSRBjabCBECc5qyg02EX/Y/AlzYh1LuNZGoFbd6u0D4DIoHZVRt X+Sh853xvQ5DqBY8Q5fBR7ILQR+KTIWRZvQ+q00i5Z6Np4CcZUQ4piawCzjd0uJJ/Zj9kX EBJD8dwFezAdAMWrFGra8+QXixXg2Fv6/koM7W+cKSCUETQEKM5j1N7jqye88HDTm0L1Fl 4yBPC7BUXH9Fie1F9LB5Cl2TMYxgPWJvDtjZTfg3Sm6x0Vr299hGcPLwh/igCw== In-Reply-To: <86o75nwilg.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Aug 2024 14:15:39 +0300") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.170; envelope-from=joseph@ushin.org; helo=out-170.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 26 Aug 2024 07:01:21 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323124 Archived-At: Eli Zaretskii writes: > you need to consider the encoding process: Emacs always encodes the > buffer text on output to the external world. If this is what you > want, then you need to use bufferpos-to-filepos, and make sure you > pass the correct coding-system argument to it. Will the following code ever signal an error? (bufferpos-to-filepos (point-max) 'exact (select-safe-coding-system (point-min) (point-max))) The `bufferpos-to-filepos' docstring says, "It is an error to request the =E2=80=98exact=E2=80=99 method when the buffer=E2=80=99s EOL format is = not yet decided." =20=20=20=20 IOW, does `select-safe-coding-system' always return an encoding which specifies EOL conversion? Thank you!! Joseph