Gnus development mailing list
 help / color / mirror / Atom feed
* shortening group names
@ 1996-02-05 21:44 Jack Vinson
  1996-02-06  0:30 ` Stainless Steel Rat
  0 siblings, 1 reply; 3+ messages in thread
From: Jack Vinson @ 1996-02-05 21:44 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shortening group names
  1996-02-05 21:44 shortening group names Jack Vinson
@ 1996-02-06  0:30 ` Stainless Steel Rat
  1996-02-06 14:04   ` Jack Vinson
  0 siblings, 1 reply; 3+ messages in thread
From: Stainless Steel Rat @ 1996-02-06  0:30 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "JV" == Jack Vinson <jvinson@cheux.ecs.umass.edu> writes:

JV> This is a revision of the function I posted earlier for shortening
JV> group names down to a given length.

There are not too many newsgroups where gnus-short-group-name (%g) is
insufficient to fit the collapsed name on the mode line; some of the
comp.infosystems groups are the only ones that have hit me.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv

iQCVAwUBMRahEZ6VRH7BJMxHAQG9igP+It1iN9KrpKfusr9ohgI8sBcsFl/ItLFN
oB6v0gnOsjjBDo/tZ9TIXKNeOgY/UmMP6+6a9jodLKeX9N7Js0sE/uYArLY8hw85
BO3On5z+wQC84v7O74dRTqlh4idrR2SX9lSWiu+3EkFZyBYUWKgaJqp7t6vL4K9s
FyG1eWXp3MY=
=HTSm
-----END PGP SIGNATURE-----
-- 
Rat <ratinox@ccs.neu.edu>          \ Happy Fun Ball may stick to certain types
PGP Public Key: Ask for one today!  \ of skin.
http://www.ccs.neu.edu/home/ratinox/ \ 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shortening group names
  1996-02-06  0:30 ` Stainless Steel Rat
@ 1996-02-06 14:04   ` Jack Vinson
  0 siblings, 0 replies; 3+ messages in thread
From: Jack Vinson @ 1996-02-06 14:04 UTC (permalink / raw)


>>>>> "SSR" == Stainless Steel Rat <ratinox@ccs.neu.edu> writes:

SSR> There are not too many newsgroups where gnus-short-group-name (%g) is
SSR> insufficient to fit the collapsed name on the mode line; some of the
SSR> comp.infosystems groups are the only ones that have hit me.

I have been using it more for the gnus-group-line-format.  Groups like
comp.os.ms-windows.programming.tools.mfc become c.o.m.p.t.mfc with the
gnus-short-group-name and with my scheme (length 30) it becomes
c.o.m.programmer.tools.mfc which I find easier to parse.  

Someone else had complained about this behavior of gnus-short-group-name as
well, which is why I did this in the first place.  It is probably obvious
to the Stainless Steel Rat, but the code I posted was a modification of the
code he wrote.  (I forgot to give credit in the original post.)

-- 
Jack Vinson - - -  jvinson@cheux.ecs.umass.edu      Sunderland, MA
<http://www.cis.upenn.edu/~vinson/home.html>
"Jesus rides beside me. He never buys any smokes"   The Replacements


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-02-06 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-02-05 21:44 shortening group names Jack Vinson
1996-02-06  0:30 ` Stainless Steel Rat
1996-02-06 14:04   ` Jack Vinson

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).