summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/autoload.el5
-rw-r--r--lisp/emacs-lisp/copyright.el33
-rw-r--r--lisp/emacs-lisp/derived.el6
3 files changed, 29 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 5e37e275632..7fbcc87b8b1 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -563,8 +563,9 @@ directory or directories specified."
(defun batch-update-autoloads ()
"Update loaddefs.el autoloads in batch mode.
Calls `update-directory-autoloads' on the command line arguments."
- (apply 'update-directory-autoloads command-line-args-left)
- (setq command-line-args-left nil))
+ (let ((args command-line-args-left))
+ (setq command-line-args-left nil)
+ (apply 'update-directory-autoloads args)))
(provide 'autoload)
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index c7194a096e1..d4501bd57b0 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -37,7 +37,7 @@
:group 'tools)
(defcustom copyright-limit 2000
- "*Don't try to update copyright beyond this position unless interactive.
+ "Don't try to update copyright beyond this position unless interactive.
A value of nil means to search whole buffer."
:group 'copyright
:type '(choice (integer :tag "Limit")
@@ -47,21 +47,28 @@ A value of nil means to search whole buffer."
"\\(©\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
\\|[Cc]opyright\\s *:?\\s *©\\)\
\\s *\\([1-9]\\([-0-9, ';\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
- "*What your copyright notice looks like.
+ "What your copyright notice looks like.
The second \\( \\) construct must match the years."
:group 'copyright
:type 'regexp)
+(defcustom copyright-names-regexp ""
+ "Regexp matching the names which correspond to the user.
+Only copyright lines where the name matches this regexp will be updated.
+This allows you to avoid adding yars to a copyright notice belonging to
+someone else or to a group for which you do not work."
+ :type 'regexp)
+
(defcustom copyright-years-regexp
"\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
- "*Match additional copyright notice years.
+ "Match additional copyright notice years.
The second \\( \\) construct must match the years."
:group 'copyright
:type 'regexp)
(defcustom copyright-query 'function
- "*If non-nil, ask user before changing copyright.
+ "If non-nil, ask user before changing copyright.
When this is `function', only ask when called non-interactively."
:group 'copyright
:type '(choice (const :tag "Do not ask")
@@ -81,7 +88,17 @@ When this is `function', only ask when called non-interactively."
"String representing the current year.")
(defun copyright-update-year (replace noquery)
- (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
+ (when
+ (condition-case err
+ (re-search-forward (concat "\\(" copyright-regexp
+ "\\)\\([ \t]*\n\\)?.*\\(?:"
+ copyright-names-regexp "\\)")
+ (+ (point) copyright-limit) t)
+ ;; 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.
+ (error (message "Can't update copyright: %s" err) nil))
+ (goto-char (match-end 1))
;; If the years are continued onto multiple lined
;; that are marked as comments, skip to the end of the years anyway.
(while (save-excursion
@@ -92,7 +109,7 @@ When this is `function', only ask when called non-interactively."
(save-match-data
(forward-line 1)
(and (looking-at comment-start-skip)
- (goto-char (match-end 0))))
+ (goto-char (match-end 1))))
(save-match-data
(looking-at copyright-years-regexp))))
(forward-line 1)
@@ -101,7 +118,7 @@ When this is `function', only ask when called non-interactively."
;; Note that `current-time-string' isn't locale-sensitive.
(setq copyright-current-year (substring (current-time-string) -4))
- (unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
+ (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
(substring copyright-current-year -2))
(if (or noquery
(y-or-n-p (if replace
@@ -233,5 +250,5 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx."
;; coding: utf-8
;; End:
-;;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8
+;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8
;;; copyright.el ends here
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 2b2cffc5a35..5fc60cf516f 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -254,11 +254,7 @@ No problems result if this variable is not bound.
,@body
)
;; Run the hooks, if any.
- ;; Make the generated code work in older Emacs versions
- ;; that do not yet have run-mode-hooks.
- (if (fboundp 'run-mode-hooks)
- (run-mode-hooks ',hook)
- (run-hooks ',hook))))))
+ (run-mode-hooks ',hook)))))
;; PUBLIC: find the ultimate class of a derived mode.