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

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