Function: chart-rmail-from

chart-rmail-from is an interactive and byte-compiled function defined in chart.el.gz.

Signature

(chart-rmail-from)

Documentation

If we are in an rmail summary buffer, then chart out the froms.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/chart.el.gz
(defun chart-rmail-from ()
  "If we are in an rmail summary buffer, then chart out the froms."
  (interactive)
  (if (not (eq major-mode 'rmail-summary-mode))
      (error "You must invoke chart-rmail-from in an rmail summary buffer"))
  (let ((nmlst nil)
	(cntlst nil))
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward "-[A-Z][a-z][a-z] +\\(\\w+\\)@\\w+" nil t)
	(let* ((nam (buffer-substring (match-beginning 1) (match-end 1)))
	       (m (member nam nmlst)))
	  (message "Scanned username %s" nam)
	  (if m
	      (let ((cell (nthcdr (- (length nmlst) (length m)) cntlst)))
		(setcar cell (1+ (car cell))))
	    (setq nmlst (cons nam nmlst)
		  cntlst (cons 1 cntlst))))))
    (chart-bar-quickie 'vertical "Username Occurrence in RMAIL box"
		       nmlst "User Names"
		       cntlst "# of occurrences"
		       10
		       (lambda (a b) (> (cdr a) (cdr b))))
    ))