From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: 35383@debbugs.gnu.org
Subject: bug#35383: 27.0.50; Complete process of decoding Gnus group names
Date: Sun, 28 Apr 2019 21:05:40 -0700 [thread overview]
Message-ID: <87d0l5ihgr.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <b4ma7gd2vg8.fsf@jpl.org> (Katsumi Yamaoka's message of "Fri, 26 Apr 2019 14:21:11 +0900")
Katsumi Yamaoka <yamaoka@jpl.org> writes:
> On Thu, 25 Apr 2019 09:10:13 -0700, Eric Abrahamsen wrote:
>> On 04/25/19 08:48 AM, Katsumi Yamaoka wrote:
>
>>> Warning: Warning - invalid active:
>
>>> for the nnnil method, that is my `gnus-select-method'. Here are
>>> the contents of ~/News/agent/nnnil/agent.lib/active:
>
>>> --8<---------------cut here---------------start------------->8---
>>> ;; -*- encoding: utf-8-emacs; -*-
>
>>> --8<---------------cut here---------------end--------------->8---
>
>>> Why the warning is issued is to run (read (current-buffer)) at
>>> the beginning of the contents. This is actually an error but
>>> `condition-case' conceals it.
>
>> Hmm, this is all done in a temp buffer,
>
> Yes. When launching Gnus, the whole contents of the active file
> are read into the " *nntpd*" buffer, copied into the temp buffer,
> and parsed (see the flow summary attatched in the bottom of this
> message for how Gnus behaves when launching).
>
>> with
>> `insert-buffer-substring' -- I wonder if the encoding cookie will even
>> be honored in this case?
>
> No, it's useless of course. Moreover, --- I changed my idea
> (patching the `gnus-active-to-gnus-format' function so as to
> ignore the coding cookie) --- I come to think that the active
> file should not contain the ones other than the active infos.
> Gnus indeed ignores the coding cookie when parsing active, but
> it is due to just a lucky side effect of `read':
>
> (read ";; coding cookie\n\nactive_info\n") => active_info
>
> I.e., `read' ignores comments in the ELisp style and whitespace.
> However, in the first place, the active file is neither an ELisp
> file nor there is no agreement for a comment style in it. So, I
> think it is better to bind `coding-system-for-(read|write)' while
> reading and writing the active file rather than adding a coding
> cookie. Though binding `coding-system-for-(read|write)' would
> probably be unnecessary since `gnus-write-active-file' binds
> `coding-system-for-write' to `nnmail-active-file-coding-system',
> and `gnus-agent-save-active' binds `coding-system-for-read' to
> `gnus-agent-file-coding-system' that defaults to `utf-8-emacs'.
> Therefore, adding a coding cookie was originally unnecessary,
> wasn't it?
>
> Here are how Gnus reads the active file for the nnnil method
> observed in my system. Note that `gnus-agent' is t (the default).
>
> (gnus 1)
> [...]
> (gnus-setup-news nil t nil)
> (gnus-get-unread-articles 1 nil)
> (require 'gnus-agent)
> (with-current-buffer " *nntpd*"
> (gnus-read-active-file-1 '(nnnil) nil)
> (gnus-active-to-gnus-format '(nnnil) hashtb nil t)
> (gnus-agent-save-active '(nnil))
> (gnus-agent-write-active "active-file" hashtb)
> ;; Add a coding cookie.
> (gnus-write-active-file "active-file" hashtb nil)
> (erase-buffer)
> (nnheader-insert-file-contents "active-file")
> (_copy to_ " *nntpd*")
> (_parse it_)
Hang on, let me slow down here.
The goal is to have Gnus default to writing its active files in
'utf-8-emacs, unless the user has specifically requested otherwise.
`nnmail-active-file-coding-system' governs the "mail" type servers, and
`gnus-agent-file-coding-system' governs the agent. Currently those two
options default to 'raw-text, we'd like them to default to 'utf-8-emacs.
But the active files have to be read correctly, as well, even by a user
who is loading this new code for the first time. That was my original
idea for the coding cookie, though obviously I was confused. Both those
options are used as the value of `coding-system-for-read' when reading
active files. So far I don't have a good solution for "upgrading" old
active files to 'utf-8.
I also realized that there's a `nnmbox-active-file-coding-system' that
defaults to 'binary.
What I find a little perplexing is that, testing with emacs 26, an nnml
active file with multibyte group names gets written to a file that my
terminal recognizes as utf-8, despite the fact that `nnmail-save-active'
sets 'coding-system-for-write' to 'raw-text, and disables multibyte. But
maybe, as Eli mentioned, that has to do with my locale...?
> P.S.
> I'll be not so active in the net for about ten days because of
> the national holidays assoc with the era name changing in Japan.
Hope it's a happy time in Japan! I'm in no rush over here.
Eric
next prev parent reply other threads:[~2019-04-29 4:05 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 18:39 bug#35383: 27.0.50; Complete process of decoding Gnus group names Eric Abrahamsen
2019-04-23 8:12 ` Katsumi Yamaoka
2019-04-23 19:55 ` Eric Abrahamsen
2019-04-24 8:06 ` Katsumi Yamaoka
2019-04-24 17:04 ` Eric Abrahamsen
2019-04-24 23:48 ` Katsumi Yamaoka
2019-04-25 16:10 ` Eric Abrahamsen
2019-04-26 5:21 ` Katsumi Yamaoka
2019-04-26 6:53 ` Eli Zaretskii
2019-04-26 8:08 ` Katsumi Yamaoka
2019-04-26 10:55 ` Eli Zaretskii
2019-04-29 4:05 ` Eric Abrahamsen [this message]
2019-04-29 4:07 ` Eric Abrahamsen
2019-04-29 15:41 ` Eli Zaretskii
2019-04-29 20:04 ` Eric Abrahamsen
2019-04-30 3:55 ` Eli Zaretskii
2019-04-30 17:03 ` Eric Abrahamsen
2019-04-30 17:11 ` Eli Zaretskii
2019-04-30 17:19 ` Eric Abrahamsen
2019-04-30 17:44 ` Eli Zaretskii
2019-04-30 18:17 ` Eric Abrahamsen
2019-04-29 15:38 ` Eli Zaretskii
2019-05-13 0:32 ` Katsumi Yamaoka
2019-05-13 20:14 ` Eric Abrahamsen
2019-05-18 20:25 ` Eric Abrahamsen
2019-05-18 22:12 ` Basil L. Contovounesios
2019-05-18 23:23 ` Eric Abrahamsen
2019-05-19 1:03 ` Basil L. Contovounesios
2019-05-19 2:56 ` Eric Abrahamsen
2019-05-19 17:02 ` Eric Abrahamsen
2019-06-10 23:19 ` Katsumi Yamaoka
2019-06-11 0:03 ` Eric Abrahamsen
2019-06-11 4:33 ` Eric Abrahamsen
2019-06-11 8:09 ` Katsumi Yamaoka
2019-04-23 15:42 ` Andy Moreton
2019-04-23 21:42 ` Eric Abrahamsen
2019-04-23 22:58 ` Andy Moreton
2019-06-17 6:06 ` Eric Abrahamsen
2019-06-17 12:12 ` Deus Max
2019-06-17 16:22 ` Eric Abrahamsen
2019-06-19 20:57 ` Deus Max
2019-06-19 21:02 ` Deus Max
2019-06-19 21:40 ` Eric Abrahamsen
2019-06-20 13:00 ` Deus Max
2019-06-20 16:29 ` Eric Abrahamsen
2019-06-20 19:01 ` Deus Max
2019-06-20 19:16 ` Eric Abrahamsen
2019-06-21 20:59 ` Eric Abrahamsen
2019-06-22 14:44 ` Deus Max
2019-06-22 16:09 ` Eric Abrahamsen
2019-06-23 10:27 ` Deus Max
2019-07-08 3:09 ` Eric Abrahamsen
2019-07-08 19:46 ` Deus Max
2019-07-23 23:52 ` Eric Abrahamsen
2019-07-30 23:00 ` Eric Abrahamsen
2019-08-01 12:07 ` Lars Ingebrigtsen
2019-08-01 16:22 ` Eric Abrahamsen
2019-08-03 21:53 ` Eric Abrahamsen
2019-09-27 14:58 ` Lars Ingebrigtsen
2019-06-19 21:28 ` Deus Max
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=87d0l5ihgr.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=35383@debbugs.gnu.org \
--cc=yamaoka@jpl.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 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.