+;; Fixme: Probably this should be amalgamated with copyright.el; also
+;; we need a check for ranges in copyright years.
+
+(defun lm-crack-copyright (&optional file)
+ "Return the copyright holder, and a list of copyright years.
+Use the current buffer if FILE is nil.
+Return argument is of the form (\"HOLDER\" \"YEAR1\" ... \"YEARN\")"
+ (lm-with-file file
+ (goto-char (lm-copyright-mark))
+ (let ((holder nil)
+ (years nil)
+ (start (point))
+ (end (line-end-position)))
+ ;; Cope with multi-line copyright `lines'. Assume the second
+ ;; line is indented (with the same commenting style).
+ (save-excursion
+ (beginning-of-line 2)
+ (let ((str (concat (match-string-no-properties 1) "[ \t]+")))
+ (beginning-of-line)
+ (while (looking-at str)
+ (setq end (line-end-position))
+ (beginning-of-line 2))))
+ ;; Make a single line and parse that.
+ (let ((buff (current-buffer)))
+ (with-temp-buffer
+ (insert-buffer-substring buff start end)
+ (goto-char (point-min))
+ (while (re-search-forward "^;+[ \t]+" nil t)
+ (replace-match ""))
+ (goto-char (point-min))
+ (while (re-search-forward " *\n" nil t)
+ (replace-match " "))
+ (goto-char (point-min))
+ (while (re-search-forward "\\([0-9]+\\),? +" nil t)
+ (setq years (cons (match-string-no-properties 1) years)))
+ (if (looking-at ".*$")
+ (setq holder (match-string-no-properties 0)))))
+ (cons holder (nreverse years)))))
+