• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/emacs-lisp/

Lines Matching +defs:copyright +defs:update

0 ;;; copyright.el --- update the copyright notice in current buffer
28 ;; Allows updating the copyright year and above mentioned GPL version manually
30 ;; Do (add-hook 'before-save-hook 'copyright-update), or use
35 (defgroup copyright nil
36 "Update the copyright notice in current buffer."
39 (defcustom copyright-limit 2000
40 "*Don't try to update copyright beyond this position unless interactive.
42 :group 'copyright
48 (defcustom copyright-regexp
49 "\\([����]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
52 "*What your copyright notice looks like.
54 :group 'copyright
57 (defcustom copyright-years-regexp
59 "*Match additional copyright notice years.
61 :group 'copyright
65 (defcustom copyright-query 'function
66 "*If non-nil, ask user before changing copyright.
68 :group 'copyright
75 (defconst copyright-current-gpl-version "2"
78 (defvar copyright-update t)
82 (defvar copyright-current-year (substring (current-time-string) -4)
85 (defun copyright-update-year (replace noquery)
86 (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
99 (looking-at copyright-years-regexp))))
102 (re-search-forward copyright-years-regexp))
105 (setq copyright-current-year (substring (current-time-string) -4))
107 (substring copyright-current-year -2))
110 (concat "Replace copyright year(s) by "
111 copyright-current-year "? ")
112 (concat "Add " copyright-current-year
113 " to copyright? "))))
115 (replace-match copyright-current-year t t nil 2)
117 (if (and (eq (% (- (string-to-number copyright-current-year)
138 (insert (substring copyright-current-year size))))))))
141 (defun copyright-update (&optional arg interactivep)
142 "Update copyright notice at beginning of buffer to indicate the current year.
145 `copyright-current-gpl-version' is set, any copying permissions
146 following the copyright are updated as well.
150 (when (or copyright-update interactivep)
151 (let ((noquery (or (not copyright-query)
152 (and (eq copyright-query 'function) interactivep))))
157 (copyright-update-year arg noquery)
159 (and copyright-current-gpl-version
165 (+ (point) copyright-limit) t)
166 (not (string= (match-string 3) copyright-current-gpl-version))
169 copyright-current-gpl-version "? ")))
173 (replace-match copyright-current-gpl-version t t nil 2))
174 (replace-match copyright-current-gpl-version t t nil 3))))
175 (set (make-local-variable 'copyright-update) nil)))
181 (defun copyright-fix-years ()
187 (if (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
216 (copyright-update nil t))
217 (message "No copyright message")))
220 (define-skeleton copyright
221 "Insert a copyright by $ORGANIZATION notice at cursor."
227 '(if (> (point) (+ (point-min) copyright-limit))
228 (message "Copyright extends beyond `copyright-limit' and won't be updated automatically."))
231 (provide 'copyright)
233 ;; For the copyright sign:
239 ;;; copyright.el ends here