Function: gnus-score-insert-help
gnus-score-insert-help is a byte-compiled function defined in
gnus-score.el.gz.
Signature
(gnus-score-insert-help STRING ALIST IDX)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-score.el.gz
(defun gnus-score-insert-help (string alist idx)
(setq gnus-score-help-winconf (current-window-configuration))
(with-current-buffer (gnus-get-buffer-create "*Score Help*")
(buffer-disable-undo)
(delete-windows-on (current-buffer))
(erase-buffer)
(insert string ":\n\n")
(let ((max -1)
(list alist)
(i 0)
n width pad format)
;; find the longest string to display
(while list
(setq n (length (nth idx (car list))))
(unless (> max n)
(setq max n))
(setq list (cdr list)))
(setq max (+ max 4)) ; %c, `:', SPACE, a SPACE at end
(setq n (/ (1- (window-width)) max)) ; items per line
(setq width (/ (1- (window-width)) n)) ; width of each item
;; insert `n' items, each in a field of width `width'
(while alist
(if (< i n)
()
(setq i 0)
(delete-char -1) ; the `\n' takes a char
(insert "\n"))
(setq pad (- width 3))
(setq format (concat "%c: %-" (int-to-string pad) "s"))
(insert (format format (caar alist) (nth idx (car alist))))
(setq alist (cdr alist))
(setq i (1+ i))))
(goto-char (point-min))
;; display ourselves in a small window at the bottom
(appt-select-lowest-window)
(if (< (/ (window-height) 2) window-min-height)
(switch-to-buffer "*Score Help*")
(split-window)
(pop-to-buffer "*Score Help*"))
(let ((window-min-height 1))
(shrink-window-if-larger-than-buffer))
(select-window (gnus-get-buffer-window gnus-summary-buffer t))))