changeset 90854:03ec96a627ba

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 773) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-211
author Miles Bader <miles@gnu.org>
date Sat, 26 May 2007 21:55:39 +0000
parents d1039e83b4a7 (current diff) 223bb8e66f74 (diff)
children 8c3bbc3bb044
files etc/NEWS lisp/ChangeLog lisp/bs.el lisp/composite.el lisp/cus-dep.el lisp/disp-table.el lisp/ediff-init.el lisp/ediff-util.el lisp/edmacro.el lisp/emacs-lisp/autoload.el lisp/emacs-lisp/copyright.el lisp/emacs-lisp/derived.el lisp/xt-mouse.el
diffstat 13 files changed, 114 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Fri May 25 05:05:41 2007 +0000
+++ b/etc/NEWS	Sat May 26 21:55:39 2007 +0000
@@ -34,6 +34,10 @@
 
 * 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
 
--- a/lisp/ChangeLog	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/ChangeLog	Sat May 26 21:55:39 2007 +0000
@@ -1,3 +1,31 @@
+2007-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* 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  <lekktu@gmail.com>
+
+	* 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  <miles@fencepost.gnu.org>
 
 	* vc-hooks.el (vc-find-root): Fix file attribute test.
--- a/lisp/bs.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/bs.el	Sat May 26 21:55:39 2007 +0000
@@ -1221,10 +1221,13 @@
 					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 @@
 					    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"))))))
--- a/lisp/composite.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/composite.el	Sat May 26 21:55:39 2007 +0000
@@ -214,7 +214,7 @@
 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 @@
 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 @@
       (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 @@
 
 
 
-;;; arch-tag: ee703d77-1723-45d4-a31f-e9f0f867aa33
+;; arch-tag: ee703d77-1723-45d4-a31f-e9f0f867aa33
 ;;; composite.el ends here
--- a/lisp/cus-dep.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/cus-dep.el	Sat May 26 21:55:39 2007 +0000
@@ -141,7 +141,7 @@
 				    (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 ")
--- a/lisp/disp-table.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/disp-table.el	Sat May 26 21:55:39 2007 +0000
@@ -220,7 +220,7 @@
 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 @@
 
 (provide 'disp-table)
 
-;;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7
+;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7
 ;;; disp-table.el ends here
--- a/lisp/ediff-init.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/ediff-init.el	Sat May 26 21:55:39 2007 +0000
@@ -110,6 +110,7 @@
 ;;
 ;; 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 @@
 ;; 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 @@
 
 
 
-;;; 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
--- a/lisp/ediff-util.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/ediff-util.el	Sat May 26 21:55:39 2007 +0000
@@ -4315,11 +4315,11 @@
 (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:
-
-;;; arch-tag: f51099b6-ef4b-470f-88a1-3a0e0b03a879
+;; 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
 ;;; ediff-util.el ends here
--- a/lisp/edmacro.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/edmacro.el	Sat May 26 21:55:39 2007 +0000
@@ -430,10 +430,7 @@
 
 (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))
--- a/lisp/emacs-lisp/autoload.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/emacs-lisp/autoload.el	Sat May 26 21:55:39 2007 +0000
@@ -563,8 +563,9 @@
 (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)
 
--- a/lisp/emacs-lisp/copyright.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/emacs-lisp/copyright.el	Sat May 26 21:55:39 2007 +0000
@@ -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 @@
  "\\(©\|@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 @@
   "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 @@
 		  (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 @@
 
     ;; 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 @@
 ;; coding: utf-8
 ;; End:
 
-;;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8
+;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8
 ;;; copyright.el ends here
--- a/lisp/emacs-lisp/derived.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/emacs-lisp/derived.el	Sat May 26 21:55:39 2007 +0000
@@ -254,11 +254,7 @@
 	  ,@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.
 
--- a/lisp/xt-mouse.el	Fri May 25 05:05:41 2007 +0000
+++ b/lisp/xt-mouse.el	Sat May 26 21:55:39 2007 +0000
@@ -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 @@
 
 (provide 'xt-mouse)
 
-;;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03
+;; arch-tag: 84962d4e-fae9-4c13-a9d7-ef4925a4ac03
 ;;; xt-mouse.el ends here