From: David Abrahams <dave@boostpro.com>
To: ding@gnus.org
Subject: Re: Shorter/customized group names?
Date: Tue, 09 Jun 2009 15:22:19 -0400 [thread overview]
Message-ID: <m2d49ddxg4.fsf@boostpro.com> (raw)
In-Reply-To: <87vdnimyxd.fsf@randomsample.de>
on Sat May 30 2009, David Engster <deng-AT-randomsample.de> wrote:
> So here's yet another version, based on your already modified one. It
> also uses an internal feature: the complete group name is saved in the
> text properties at the beginning of each group line. Since many internal
> Gnus functions use these, this isn't likely to change.
>
> (defun DE-collapse-group-names ()
> (save-excursion
> (let (previous-group current-group common-prefix
> common-dot-count prefix suffix)
> (goto-char (point-min))
> (while (not (eobp))
> (when (setq current-group
> (get-text-property (point) 'gnus-group))
> (setq current-group (symbol-name current-group))
> (when (string-match "\\(.+\\):\\(.+\\)" current-group)
> (setq current-group (match-string 2 current-group)))
> (setq common-prefix (substring current-group 0
> (mismatch previous-group current-group))
> common-dot-count (count ?. common-prefix)
> prefix (mapconcat (lambda (x) x)
> (make-list common-dot-count " .") "")
> suffix (and (string-match
> (format "\\([^.]*[.]\\)\\{%d\\}\\(.+\\)" common-dot-count)
> current-group)
> (match-string 2 current-group))
> previous-group current-group)
> (unless (zerop (length prefix))
> (when (search-forward current-group (point-at-eol) t)
> (let ((props (text-properties-at (1- (point)))))
> (replace-match (apply 'propertize (concat prefix suffix)
> props))))))
> (forward-line 1)))))
>
> (add-hook 'gnus-group-prepare-hook 'DE-collapse-group-names)
> (add-hook 'gnus-group-update-group-hook 'DE-collapse-group-names)
>
> This code assumes that you use "%G" in your group line format.
>
> I think you can even omit the last hook if you don't use a three pane
> buffer configuration.
Ah, but I do! But this is fantastic; it really works. Thank you for
all your help on this one!
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
next prev parent reply other threads:[~2009-06-09 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 20:02 David Abrahams
2009-05-27 21:57 ` David Engster
2009-05-28 4:42 ` David Abrahams
2009-05-28 9:43 ` David Engster
2009-05-29 14:51 ` David Abrahams
2009-05-29 16:50 ` David Engster
2009-05-29 18:02 ` David Abrahams
2009-05-29 22:31 ` David Abrahams
2009-05-30 14:46 ` David Engster
2009-06-09 19:22 ` David Abrahams [this message]
2009-07-08 19:17 ` Ted Zlatanov
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=m2d49ddxg4.fsf@boostpro.com \
--to=dave@boostpro.com \
--cc=ding@gnus.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).