diff --git a/etc/NEWS b/etc/NEWS index 9d32a7034a9..780dea787f9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -34,6 +34,10 @@ with a prefix argument or by typing C-u C-h C-n. * Changes in Specialized Modes and Packages in Emacs 23.1 +** In the `copyright' package, you can specify your copyright holders's names. +Only copyright lines with holders matching copyright-names-regexp will be +considered for update. + * Changes in Emacs 23.1 on non-free operating systems diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be975f67e99..0d1d4d59110 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,31 @@ +2007-05-25 Stefan Monnier + + * emacs-lisp/derived.el (define-derived-mode): Remove bogus + compatibiity code. + + * emacs-lisp/copyright.el (copyright-names-regexp): New var. + (copyright-update-year): Use it. + + * edmacro.el (edmacro-format-keys): Use current-active-maps. + + * ediff-init.el (ediff-defvar-local, ediff-with-current-buffer): + Add indentation and debugging info. Fix up comment convention. + + * cus-dep.el (custom-make-dependencies): Simplify. + + * composite.el (compose-region, decompose-region): + Use inhibit-read-only and restore-buffer-modified-p. + + * xt-mouse.el (xterm-mouse-truncate-wrap): New function. + (xterm-mouse-event): Use it. + +2007-05-25 Juanma Barranquero + + * bs.el (bs-cycle-previous): Don't modify the cycle list until + `switch-to-buffer' has returned succesfully. + (bs-cycle-next): Ditto. Also, don't bury the buffer when the + window is dedicated (it could iconify the frame). + 2007-05-25 Miles Bader * vc-hooks.el (vc-find-root): Fix file attribute test. diff --git a/lisp/bs.el b/lisp/bs.el index b1fa47100f0..5951d129d96 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -1221,10 +1221,13 @@ by buffer configuration `bs-cycle-configuration-name'." bs--cycle-list))) (next (car tupel)) (cycle-list (cdr tupel))) + (unless (window-dedicated-p (selected-window)) + ;; We don't want the frame iconified if the only window in the frame + ;; happens to be dedicated; let's get the error from switch-to-buffer + (bury-buffer)) + (switch-to-buffer next) (setq bs--cycle-list (append (cdr cycle-list) (list (car cycle-list)))) - (bury-buffer) - (switch-to-buffer next) (bs-message-without-log "Next buffers: %s" (or (cdr bs--cycle-list) "this buffer")))))) @@ -1251,9 +1254,9 @@ by buffer configuration `bs-cycle-configuration-name'." bs--cycle-list))) (prev-buffer (car tupel)) (cycle-list (cdr tupel))) + (switch-to-buffer prev-buffer) (setq bs--cycle-list (append (last cycle-list) (reverse (cdr (reverse cycle-list))))) - (switch-to-buffer prev-buffer) (bs-message-without-log "Previous buffers: %s" (or (reverse (cdr bs--cycle-list)) "this buffer")))))) diff --git a/lisp/composite.el b/lisp/composite.el index b5da251bb85..99cbd85cf01 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -214,7 +214,7 @@ adjust the composition when it gets invalid because of a change of text in the composition." (interactive "r") (let ((modified-p (buffer-modified-p)) - (buffer-read-only nil)) + (inhibit-read-only t)) (if (or (vectorp components) (listp components)) (setq components (encode-composition-components components))) (compose-region-internal start end components modification-func) @@ -227,9 +227,9 @@ When called from a program, expects two arguments, positions (integers or markers) specifying the region." (interactive "r") (let ((modified-p (buffer-modified-p)) - (buffer-read-only nil)) + (inhibit-read-only t)) (remove-text-properties start end '(composition nil)) - (set-buffer-modified-p modified-p))) + (restore-buffer-modified-p modified-p))) (defun compose-string (string &optional start end components modification-func) "Compose characters in string STRING. @@ -648,8 +648,8 @@ With arg, enable it iff arg is positive." (set-buffer-modified-p modified-p)))) -;;; The following codes are only for backward compatibility with Emacs -;;; 20.4 and earlier. +;; The following codes are only for backward compatibility with Emacs +;; 20.4 and earlier. (defun decompose-composite-char (char &optional type with-composition-rule) "Convert CHAR to string. @@ -666,5 +666,5 @@ Optional 3rd arg WITH-COMPOSITION-RULE is ignored." -;;; arch-tag: ee703d77-1723-45d4-a31f-e9f0f867aa33 +;; arch-tag: ee703d77-1723-45d4-a31f-e9f0f867aa33 ;;; composite.el ends here diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el index 713b84f8bc0..98af13cec69 100644 --- a/lisp/cus-dep.el +++ b/lisp/cus-dep.el @@ -141,7 +141,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" (member where (cdr (assoc version version-alist))) (push where (cdr (assoc version version-alist)))) - (push (cons version (list where)) version-alist))) + (push (list version where) version-alist))) ;; This is a group (insert "(custom-put-if-not '" (symbol-name symbol) " 'custom-version ") diff --git a/lisp/disp-table.el b/lisp/disp-table.el index dbe67dacb39..15231b084ed 100644 --- a/lisp/disp-table.el +++ b/lisp/disp-table.el @@ -220,7 +220,7 @@ with either the `--unibyte' option or the EMACS_UNIBYTE environment variable, or else customize `enable-multibyte-characters'. With prefix argument, this command enables European character display -if arg is positive, disables it otherwise. Otherwise, it toggles +if ARG is positive, disables it otherwise. Otherwise, it toggles European character display. When this mode is enabled, characters in the range of 160 to 255 @@ -264,5 +264,5 @@ for users who call this function in `.emacs'." (provide 'disp-table) -;;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7 +;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7 ;;; disp-table.el ends here diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index 0ecc809797f..d37096f9e89 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el @@ -110,6 +110,7 @@ that Ediff doesn't know about.") ;; ;; Plagiarised from `emerge-defvar-local' for XEmacs. (defmacro ediff-defvar-local (var value doc) + (declare (indent defun)) `(progn (defvar ,var ,value ,doc) (make-variable-buffer-local ',var) @@ -258,6 +259,7 @@ It needs to be killed when we quit the session.") ;; Doesn't save the point and mark. ;; This is `with-current-buffer' with the added test for live buffers." (defmacro ediff-with-current-buffer (buffer &rest body) + (declare (indent 1) (debug (form body))) `(if (ediff-buffer-live-p ,buffer) (save-current-buffer (set-buffer ,buffer) @@ -1873,11 +1875,11 @@ Unless optional argument INPLACE is non-nil, return a new string." -;;; Local Variables: -;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) -;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) -;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) -;;; End: +;; Local Variables: +;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) +;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) +;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) +;; End: -;;; arch-tag: fa31d384-1e70-4d4b-82a7-3e96307c46f5 +;; arch-tag: fa31d384-1e70-4d4b-82a7-3e96307c46f5 ;;; ediff-init.el ends here diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index 7483128b71a..34af5cc146b 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el @@ -4315,11 +4315,11 @@ Mail anyway? (y or n) ") (provide 'ediff-util) -;;; Local Variables: -;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) -;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) -;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) -;;; End: +;; Local Variables: +;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) +;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) +;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) +;; End: -;;; arch-tag: f51099b6-ef4b-470f-88a1-3a0e0b03a879 +;; arch-tag: f51099b6-ef4b-470f-88a1-3a0e0b03a879 ;;; ediff-util.el ends here diff --git a/lisp/edmacro.el b/lisp/edmacro.el index e21dbaa8f35..86a26b9b714 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -430,10 +430,7 @@ doubt, use whitespace." (defun edmacro-format-keys (macro &optional verbose) (setq macro (edmacro-fix-menu-commands macro)) - (let* ((maps (append (current-minor-mode-maps) - (if (current-local-map) - (list (current-local-map))) - (list (current-global-map)))) + (let* ((maps (current-active-maps)) (pkeys '(end-macro ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?- ?\C-u ?\M-- ?\M-0 ?\M-1 ?\M-2 ?\M-3 ?\M-4 ?\M-5 ?\M-6 ?\M-7 ?\M-8 ?\M-9)) 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. diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 3a7c8fd553a..349bfb3f764 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -126,6 +126,21 @@ (+ c #x8000000 128) c))) +(defun xterm-mouse-truncate-wrap (f) + "Truncate with wrap-around." + (condition-case nil + ;; First try the built-in truncate, in case there's no overflow. + (truncate f) + ;; In case of overflow, do wraparound by hand. + (range-error + ;; In our case, we wrap around every 3 days or so, so if we assume + ;; a maximum of 65536 wraparounds, we're safe for a couple years. + ;; Using a power of 2 makes rounding errors less likely. + (let* ((maxwrap (* 65536 2048)) + (dbig (truncate (/ f maxwrap))) + (fdiff (- f (* 1.0 maxwrap dbig)))) + (+ (truncate fdiff) (* maxwrap dbig)))))) + (defun xterm-mouse-event () "Convert XTerm mouse event to Emacs mouse event." (let* ((type (- (xterm-mouse-event-read) #o40)) @@ -133,12 +148,12 @@ (y (- (xterm-mouse-event-read) #o40 1)) ;; Emulate timestamp information. This is accurate enough ;; for default value of mouse-1-click-follows-link (450msec). - (timestamp (truncate - (* 1000 - (- (float-time) - (or xt-mouse-epoch - (setq xt-mouse-epoch (float-time))))))) - (mouse (intern + (timestamp (xterm-mouse-truncate-wrap + (* 1000 + (- (float-time) + (or xt-mouse-epoch + (setq xt-mouse-epoch (float-time))))))) + (mouse (intern ;; For buttons > 3, the release-event looks ;; differently (see xc/programs/xterm/button.c, ;; function EditorButton), and there seems to come in @@ -210,5 +225,5 @@ down the SHIFT key while pressing the mouse button." (provide 'xt-mouse) -;;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 +;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03 ;;; xt-mouse.el ends here