Function: copyright-find-copyright
copyright-find-copyright is a byte-compiled function defined in
copyright.el.gz.
Signature
(copyright-find-copyright)
Documentation
Return non-nil if a copyright header suitable for updating is found.
The header must match copyright-regexp and copyright-names-regexp, if set.
This function sets the match data that copyright-update-year uses.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/copyright.el.gz
(defun copyright-find-copyright ()
"Return non-nil if a copyright header suitable for updating is found.
The header must match `copyright-regexp' and `copyright-names-regexp', if set.
This function sets the match data that `copyright-update-year' uses."
(widen)
(goto-char (copyright-start-point))
;; In case the regexp is rejected. This is useful because
;; copyright-update is typically called from before-save-hook where
;; such an error is very inconvenient for the user.
(with-demoted-errors "Can't update copyright: %s"
;; (1) Need the extra \\( \\) around copyright-regexp because we
;; goto (match-end 1) below. See note (2) below.
(let ((regexp (concat "\\(" copyright-regexp
"\\)\\([ \t]*\n\\)?.*\\(?:"
copyright-names-regexp "\\)")))
(when (copyright-re-search regexp (copyright-limit) t)
;; We may accidentally have landed in the middle of a
;; copyright line, so re-perform the search without the
;; limit. (Otherwise we may be inserting the new year in the
;; middle of the list of years.)
(if copyright-at-end-flag
(goto-char (match-end 0))
(goto-char (match-beginning 0)))
(copyright-re-search regexp nil t)))))