Gnus development mailing list
 help / color / mirror / Atom feed
From: jvinson@cheux.ecs.umass.edu (Jack Vinson)
Subject: shortening group names
Date: 05 Feb 1996 16:44:50 -0500	[thread overview]
Message-ID: <wovillmoq5.fsf@cheux.ecs.umass.edu> (raw)


This is a revision of the function I posted earlier for shortening group
names down to a given length.  The previous version relied on "group" being
set in the function gnus-group-insert-group-line.  It now uses the global
temporary variable gnus-tmp-group for the group name.  Does anyone know if
the length parameter from the format spec gets stuck in a gnus-tmp-*
variable?  I don't see any likely candidates.

I have this set up to use the %uc format specifier.

This was done as an alternative to using %g which contracts all but the
deepest element of the group name.  This will contract elements until the
group name is not greater than jmv-gnus-short-group-name-length.  This
works in sgnus-0.35 and will work in 0.36 as well.


;; My functions for shortening the Group name
(defvar jmv-gnus-short-group-name-length 30 
  "Maximum length of shortened newsgroup name.  Gnus will abbreviate group
name components until this length or less.")

(defun gnus-user-format-function-c (group-tmp)
  "Collapse GROUP name down to jmv-gnus-short-group-name-length."
  (if (> (length gnus-tmp-group) jmv-gnus-short-group-name-length) 
      (let* ((group gnus-tmp-group)
	     (name "") (foreign "") (depth 0) (skip 1)
	     )
	(if (string-match ":" group)
	    (setq foreign (substring group 0 (match-end 0))
		  group (substring group (match-end 0))))
	(while group
	  (if (and (> (+ (length name) (length group)) jmv-gnus-short-group-name-length)
		   (string-match "\\." group))
	      (setq name (concat name (substring group 0 1))
		    group (substring group (match-end 0))
		    name (concat name "."))
	    (setq name (concat foreign name group)
		  group nil)))
	name)
    gnus-tmp-group)
  )

-- 
Jonathan "Jack" Vinson       jvinson@cheux.ecs.umass.edu
Sunderland, MA               <http://www.cis.upenn.edu/~vinson/home.html>
"Churchill was a shopping bag" - Fatima Mansions


             reply	other threads:[~1996-02-05 21:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-05 21:44 Jack Vinson [this message]
1996-02-06  0:30 ` Stainless Steel Rat
1996-02-06 14:04   ` Jack Vinson

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=wovillmoq5.fsf@cheux.ecs.umass.edu \
    --to=jvinson@cheux.ecs.umass.edu \
    /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).