Gnus development mailing list
 help / color / mirror / Atom feed
From: James Cloos <cloos+math_uh-ding@jhcloos.com>
To: ding@gnus.org
Cc: Michael Olson <mwolson@member.fsf.org>, <jidanni@jidanni.org>
Subject: Re: .newsrc.eld should have one newline per group
Date: Wed, 05 Dec 2007 23:18:40 +0000	[thread overview]
Message-ID: <m3hciw7msv.fsf@lugabout.jhcloos.org> (raw)
In-Reply-To: <87k5ntsodd.fsf@grepfind.mwolson.org> (Michael Olson's message of "Wed, 05 Dec 2007 00:26:54 -0500")

>>>>> "Jidanni" == <jidanni@jidanni.org> writes:
>>>>> "Michael" == Michael Olson <mwolson@member.fsf.org> writes:

Jidanni> we instead maintain .newsrc.eld with one newline per newsgroup,
Jidanni> yes lisp indented, but minimally.

Michael> I fully agree.  I recently had to selectively restore items
Michael> from a backed-up .newsrc.eld file, and Emacs took a long time
Michael> to move around in that file.

I'd like to see that as well, but it isn't the easiest change to make.

The current code uses (symbol-value) to get the value of each variable
when writing out the (setq) lines into the buffer which gets written out
to the ~/.nesrc.eld file.

Emacs-lisp-mode has a (lisp-fill-paragraph) function, but that is more
about filling comment blocks correctly; new code will be required which
calls (fill-paragraph) will useful values for paragraph-start, et al
and then runs (indent-sexp).

The latter will force gnus to depend on lisp-mode.el.  And you can
probably imagine how slow saving will become if that has to be done
every time.

I don't beleive that is a viable option.

The other alternative is to loop through gnus-newsrc-alist one value at
a time, storing it in a temp variable and calling (symbol-value) on each
of those.  If you want to do that, you need to hack on gnus-start.el
changing (gnus-gnus-to-quick-newsrc-format) to remove gnus-newsrc-alist
from variables before calling the (while variables) loop.  The (delq)
call shows how; be sure to change both calls to gnus-variable-list.
Then you can loop through (cdr gnus-newsrc-alist) and write out each
entry with whatever indent you prefer.  Be sure to end up with a proper
(setq) call.

Incidently, I use this on the ~/.newsrc.eld file before trying to edit it:

perl -pe 's/\(\("/( ("/;s/ \("/\n ("/g' <~/.newsrc.eld >~/tmp/newsrc.el

and then after editing and saving the temp file (~/newsrc.el above) I
cat that file >~/.newsrc.eld.

The first s/// adds a space between the parenthesis of the (setq)'s '((
opening; the second s/// adds a newline before each space+parent+quote
trio.  It works only because of the specific format of the newsrc alist,
in that the (car) of each sexp in the alist starts with the group name
as a quoted string.

Hmmm.  In retrospect, I suppose one could add a call to the equivilent
elisp to (gnus-save-newsrc-file) between each call to
(gnus-gnus-to-quick-newsrc-format) and the ensuing call to (save-buffer)
to accomplish one-line per group.  Have fun with the regexp!
And read the last paragraph of the docstring for (replace-regexp)
for the proper idiom to use.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



  reply	other threads:[~2007-12-05 23:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30  0:58 how to delete groups despite backend jidanni
2007-11-30  1:22 ` Dave Goldberg
2007-11-30  1:32 ` Katsumi Yamaoka
2007-12-03  0:02   ` .newsrc.eld should have one newline per group jidanni
2007-12-03 23:55     ` jidanni
2007-12-04  1:27       ` jidanni
2007-12-05  5:26     ` Michael Olson
2007-12-05 23:18       ` James Cloos [this message]
2007-12-06  7:35         ` Reiner Steib
2007-12-07  1:00           ` reader
2007-12-06  8:35         ` Daniel Pittman
2007-12-06 12:43         ` jidanni
2007-12-03  0:11   ` how to delete groups despite backend jidanni

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=m3hciw7msv.fsf@lugabout.jhcloos.org \
    --to=cloos+math_uh-ding@jhcloos.com \
    --cc=ding@gnus.org \
    --cc=jidanni@jidanni.org \
    --cc=mwolson@member.fsf.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.
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 NNTP newsgroup(s).