unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joseph Turner <joseph@ushin.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: How to get buffer byte length (not number of characters)?
Date: Sun, 25 Aug 2024 23:37:49 -0700	[thread overview]
Message-ID: <87mskz7ps2.fsf@ushin.org> (raw)
In-Reply-To: <86o75nwilg.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Aug 2024 14:15:39 +0300")

Eli Zaretskii <eliz@gnu.org> 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 ‘exact’ method when the buffer’s EOL format is not yet decided."
    
IOW, does `select-safe-coding-system' always return an encoding which
specifies EOL conversion?

Thank you!!

Joseph



  parent reply	other threads:[~2024-08-26  6:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  7:10 How to get buffer byte length (not number of characters)? Joseph Turner
2024-08-20  7:51 ` Joseph Turner
2024-08-20 11:20   ` Eli Zaretskii
2024-08-20 11:15 ` Eli Zaretskii
2024-08-21  9:20   ` Joseph Turner
2024-08-21 17:47     ` Eli Zaretskii
2024-08-21 23:52       ` Joseph Turner
2024-08-22  4:06         ` Eli Zaretskii
2024-08-22  7:24           ` Joseph Turner
2024-08-22 11:04             ` Eli Zaretskii
2024-08-22 18:29               ` Joseph Turner
2024-08-22 18:44                 ` Eli Zaretskii
2024-08-22 19:32                   ` tomas
2024-08-23  3:56                   ` Joseph Turner
2024-08-23  7:02                     ` Eli Zaretskii
2024-08-23  7:37                       ` Joseph Turner
2024-08-23 12:34                         ` Eli Zaretskii
2024-08-23  7:43                       ` Joseph Turner
2024-08-23 12:38                         ` Eli Zaretskii
2024-08-23 16:59                           ` Joseph Turner
2024-08-23 17:35                             ` Eli Zaretskii
2024-08-23 20:37                               ` Joseph Turner
2024-08-24  6:14                     ` Joseph Turner
2024-08-22 12:26             ` Adam Porter
2024-08-22 12:47               ` tomas
2024-08-23  6:28                 ` Adam Porter
2024-08-22 13:50               ` Eli Zaretskii
2024-08-23  6:31                 ` Adam Porter
2024-08-23  6:51                   ` Eli Zaretskii
2024-08-23  7:07                   ` Joseph Turner
2024-08-23  7:58                     ` Joseph Turner
2024-08-22  7:09     ` Andreas Schwab
2024-08-22  7:30       ` Joseph Turner
2024-08-22 11:05         ` Eli Zaretskii
2024-08-26  6:37   ` Joseph Turner [this message]
2024-08-26  6:49     ` Joseph Turner
2024-08-26 11:22       ` Eli Zaretskii
2024-08-27  4:48         ` Joseph Turner
2024-08-26 11:20     ` Eli Zaretskii
2024-08-20 11:24 ` Andreas Schwab

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mskz7ps2.fsf@ushin.org \
    --to=joseph@ushin.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).