* creating gnus-user-format-function- to shorten group name
@ 1996-01-25 15:52 Jack Vinson
0 siblings, 0 replies; only message in thread
From: Jack Vinson @ 1996-01-25 15:52 UTC (permalink / raw)
I've taken up the challenge to create a function which will shorten
a newsgroup name only when the name is longer than I desire. It wasn't
really that hard.
I took gnus-short-group-name as a starting point and came up with the code
below. However, when I created a gnus-user-format-function- for it, I
got an error that 'gnus-tmp-header was not defined. I also do not know how
to extract the length parameter from the format specification.
I can correct the problem with 'gnus-tmp-header, see my patch for gnus.el.
To use my function as a gnus-user-format-function-, I've created a new
variable to hold the maximum length of a group name, and define the
function for a %uc parameter.
(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)
(jmv-gnus-contract-group-name group jmv-gnus-short-group-name-length))
(defun jmv-gnus-contract-group-name (group name-length)
"Collapse GROUP name down to NAME-LENGTH."
(if (> (length group) name-length)
(let* ((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)) 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)
group)
)
--
Jack Vinson Sunderland, MA
jvinson@cheux.ecs.umass.edu <http://www.cis.upenn.edu/~vinson/home.html>
"There's balogna in our slacks."
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-01-25 15:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-01-25 15:52 creating gnus-user-format-function- to shorten group name 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).