From: Eli Zaretskii <eliz@gnu.org>
To: Joseph Turner <joseph@ushin.org>
Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net
Subject: Re: How to get buffer byte length (not number of characters)?
Date: Fri, 23 Aug 2024 20:35:41 +0300 [thread overview]
Message-ID: <86h6bbp2fm.fsf@gnu.org> (raw)
In-Reply-To: <87o75j5g5x.fsf@ushin.org> (message from Joseph Turner on Fri, 23 Aug 2024 09:59:22 -0700)
> From: Joseph Turner <joseph@ushin.org>
> Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net
> Date: Fri, 23 Aug 2024 09:59:22 -0700
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Joseph Turner <joseph@ushin.org>
> >> Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net
> >> Date: Fri, 23 Aug 2024 00:43:52 -0700
> >>
> >> I'm surprised that
> >>
> >> (with-temp-buffer
> >> (insert "你好")
> >> (set-buffer-file-coding-system 'chinese-big5)
> >> (car (find-coding-systems-region (point-min) (point-max))))
> >>
> >> returns 'utf-8 and not 'chinese-big5.
> >
> > What does coding-system-priority-list returns in your case?
>
> 'utf-8
That explains what you see, then.
> >> Are the codings intended to be
> >> ordered by priority?
> >
> > Yes.
> >
> >> If so, should buffer-file-coding-system be at the front of the list
> >> if it's safe?
> >
> > How do you know it's safe?
> >
> > If your application needs to prefer buffer-file-coding-system, then
> > you should see if buffer-file-coding-system is a member of the list
> > returned by find-coding-systems-region, and if so, use that.
>
> I'd have thought that most applications would want to prefer
> buffer-file-coding-system if it's a member of the list returned by
> find-coding-systems-region, but perhaps not.
Most applications use select-safe-coding-system, which AFAIR already
does all that.
next prev parent reply other threads:[~2024-08-23 17:35 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86h6bbp2fm.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=adam@alphapapa.net \
--cc=emacs-devel@gnu.org \
--cc=joseph@ushin.org \
--cc=schwab@suse.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.