emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list-print-separator


From: Andy Moreton
Subject: Re: list-print-separator
Date: Tue, 26 Apr 2011 13:52:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt)

On Mon 25 Apr 2011, Ted Zlatanov wrote:

> On Mon, 25 Apr 2011 22:05:43 +0100 Andy Moreton <address@hidden> wrote: 
>
> AM> On Mon 25 Apr 2011, Stefan Monnier wrote:
> SM> Hmm... I wouldn't try to compare the speed of `print' with that of `pp'
> SM> since they do very different amounts of work and are implemented in
> SM> languages whose performance is very different, but there's clearly room
> SM> for improvement in pp's speed.
>>>> I want to print out a large ELisp data structure prettily.  The Gnus
>>>> newsrc.eld, for example, or the Gnus registry hashtable.  I'll use
>>>> whatever makes it happen as fast as possible.
>>> 
>>> The newsrc.eld has never been pretty and it's never been a problem, AFAIK.
>>> Not sure what's the "Gnus registry", so I can't comment on that.
>
> AM> I use somthing like this for a prettier newsrc.eld:
>
> AM> (add-hook 'gnus-save-quick-newsrc-hook
> AM>           (lambda ()
> AM>             (save-excursion
> AM>               (goto-char (point-min))
> AM>               (save-match-data
> AM>                 (while (re-search-forward "(\\\"\\| ((\\| (nn" nil t)
> AM>                   (replace-match "\n  \\&" t)))
> AM>               (delete-trailing-whitespace))))
>
> AM> It may not be perfect, but it does make it a great deal more readable.
>
> Me too, but that doesn't work for new users, it relies on regular
> expressions, and it's slow.  My suggestion for the above was basically
> to make `list-print-separator' "\n \\" but I will instead work on `pp'
> as Stefan has requested.

New users may have difficulty with regexps, so why not just do this
inside gnus anyway ? The regexp loop is pretty simple , and I've never
noticed it being slow. Tweaking `pp' is useful too though.

    AndyM





reply via email to

[Prev in Thread] Current Thread [Next in Thread]