changeset 109434:a11596ec5941

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 14 Jul 2010 22:46:23 +0000
parents f16404a62b75 (current diff) 3fcc8637a887 (diff)
children cb913a283247
files
diffstat 20 files changed, 252 insertions(+), 164 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Tue Jul 13 22:45:58 2010 +0000
+++ b/etc/NEWS	Wed Jul 14 22:46:23 2010 +0000
@@ -173,6 +173,20 @@
 
 *** The option `mouse-region-delete-keys' has been deleted.
 
+** Selection changes.
+
+The way Emacs interacts with the clipboard and primary selection, by
+default, is now similar to other X applications.  In particular, kill
+and yank use the clipboard, in addition to the primary selection.
+
+*** `select-active-regions' now defaults to t.
+
+*** `x-select-enable-clipboard' now defaults to t.
+
+*** `mouse-drag-copy-region' now defaults to nil.
+
+*** `mouse-2' is now bound to `mouse-yank-primary'.
+
 
 * Changes in Specialized Modes and Packages in Emacs 24.1
 
--- a/lisp/ChangeLog	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/ChangeLog	Wed Jul 14 22:46:23 2010 +0000
@@ -1,3 +1,54 @@
+2010-07-14  Karl Fogel  <kfogel@red-bean.com>
+
+	* bookmark.el (bookmark-load-hook): Fix doc string as suggested
+	by Drew Adams (Bug#5504).
+
+2010-07-14  Chong Yidong  <cyd@stupidchicken.com>
+
+	* term/x-win.el (x-select-enable-clipboard): Default to t.
+	(x-initialize-window-system): Don't overwrite Paste menu item.
+
+	* simple.el (select-active-regions): Default to t.
+	(push-mark-command): Don't overwrite primary with empty string.
+
+	* mouse.el: Bind mouse-2 to mouse-yank-primary.
+	(mouse-drag-copy-region): Default to nil.
+
+	* menu-bar.el (menu-bar-enable-clipboard): Don't overwrite
+	Cut/Copy/Paste menu bar items.
+
+2010-07-13  Thierry Volpiatto <thierry.volpiatto@gmail.com>
+
+	Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
+	Patch applied by Karl Fogel.
+
+	* bookmark.el (bookmark-set): Don't set `bookmark-yank-point'
+	and `bookmark-current-buffer' if they have been already set in
+	another buffer (e.g gnus-art).
+
+2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+            Thierry Volpiatto <thierry.volpiatto@gmail.com>
+
+	Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
+
+	* bookmark.el (bookmark-make-record-default): Allow unneeded
+	information to be omitted from the record.
+
+	Adjust declarations and calls:
+
+	* info.el (bookmark-make-record-default): Adjust declaration.
+	(Info-bookmark-make-record): Adjust call.
+
+	* woman.el (bookmark-make-record-default): Adjust declaration.
+	(woman-bookmark-make-record): Adjust call.
+
+	* man.el (bookmark-make-record-default): Adjust declaration.
+	(Man-bookmark-make-record): Adjust call.
+
+	* image-mode.el (bookmark-make-record-default): Adjust declaration.
+
+	* doc-view.el (bookmark-make-record-default): Adjust declaration.
+
 2010-07-13  Karl Fogel  <kfogel@red-bean.com>
 
 	* bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
@@ -5,11 +56,11 @@
 	because it was extraneous to the functional change in that patch,
 	and causes a re-indendation, I am committing it separately.
 
-2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
 
 	* bookmark.el (bookmark-show-annotation): Ensure annotations show,
 	e.g. in Info bookmarks, by using `switch-to-buffer-other-window'.
-	Patch by Thierry Volpiatto (Bug#6444).
+	Patch applied by Karl Fogel (Bug#6444).
 
 2010-07-13  Chong Yidong  <cyd@stupidchicken.com>
 
--- a/lisp/bookmark.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/bookmark.el	Wed Jul 14 22:46:23 2010 +0000
@@ -528,26 +528,36 @@
     (setq bookmark-current-bookmark stripped-name)
     (bookmark-bmenu-surreptitiously-rebuild-list)))
 
-(defun bookmark-make-record-default (&optional point-only)
+(defun bookmark-make-record-default (&optional no-file no-context posn)
   "Return the record describing the location of a new bookmark.
-Must be at the correct position in the buffer in which the bookmark is
-being set.
-If POINT-ONLY is non-nil, then only return the subset of the
-record that pertains to the location within the buffer."
-  `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name))))
-    (front-context-string
-     . ,(if (>= (- (point-max) (point)) bookmark-search-size)
-            (buffer-substring-no-properties
-             (point)
-             (+ (point) bookmark-search-size))
-          nil))
-    (rear-context-string
-     . ,(if (>= (- (point) (point-min)) bookmark-search-size)
-            (buffer-substring-no-properties
-             (point)
-             (- (point) bookmark-search-size))
-          nil))
-    (position . ,(point))))
+Point should be at the buffer in which the bookmark is being set,
+and normally should be at the position where the bookmark is desired,
+but see the optional arguments for other possibilities.
+
+If NO-FILE is non-nil, then only return the subset of the
+record that pertains to the location within the buffer, leaving off
+the part that records the filename.
+
+If NO-CONTEXT is non-nil, do not include the front- and rear-context
+strings in the record -- the position is enough.
+
+If POSN is non-nil, record POSN as the point instead of `(point)'."
+  `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name))))
+    ,@(unless no-context `((front-context-string
+                           . ,(if (>= (- (point-max) (point))
+                                      bookmark-search-size)
+                                  (buffer-substring-no-properties
+                                   (point)
+                                   (+ (point) bookmark-search-size))
+                                  nil))))
+    ,@(unless no-context `((rear-context-string
+                           . ,(if (>= (- (point) (point-min))
+                                      bookmark-search-size)
+                                  (buffer-substring-no-properties
+                                   (point)
+                                   (- (point) bookmark-search-size))
+                                  nil))))
+    (position . ,(or posn (point)))))
 
 
 ;;; File format stuff
@@ -773,27 +783,34 @@
 it removes only the first instance of a bookmark with that name from
 the list of bookmarks.)"
   (interactive (list nil current-prefix-arg))
-  (let* ((record (bookmark-make-record))
-         (default (car record)))
+  (unwind-protect
+       (let* ((record (bookmark-make-record))
+              (default (car record)))
 
-    (bookmark-maybe-load-default-file)
-
-    (setq bookmark-yank-point (point))
-    (setq bookmark-current-buffer (current-buffer))
+         (bookmark-maybe-load-default-file)
+         ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
+         ;; if they have been already set in another buffer. (e.g gnus-art).
+         (unless (and bookmark-yank-point
+                      bookmark-current-buffer)
+           (setq bookmark-yank-point (point))
+           (setq bookmark-current-buffer (current-buffer)))
 
-    (let ((str
-           (or name
-               (read-from-minibuffer
-                (format "Set bookmark (%s): " default)
-                nil
-                bookmark-minibuffer-read-name-map
-                nil nil default))))
-      (and (string-equal str "") (setq str default))
-      (bookmark-store str (cdr record) no-overwrite)
+         (let ((str
+                (or name
+                    (read-from-minibuffer
+                     (format "Set bookmark (%s): " default)
+                     nil
+                     bookmark-minibuffer-read-name-map
+                     nil nil default))))
+           (and (string-equal str "") (setq str default))
+           (bookmark-store str (cdr record) no-overwrite)
 
-      ;; Ask for an annotation buffer for this bookmark
-      (when bookmark-use-annotations
-        (bookmark-edit-annotation str)))))
+           ;; Ask for an annotation buffer for this bookmark
+           (when bookmark-use-annotations
+             (bookmark-edit-annotation str))))
+    (setq bookmark-yank-point nil)
+    (setq bookmark-current-buffer nil)))
+
 
 (defun bookmark-kill-line (&optional newline-too)
   "Kill from point to end of line.
@@ -2179,7 +2196,7 @@
 
 ;; Load Hook
 (defvar bookmark-load-hook nil
-  "Hook run at the end of loading bookmark.")
+  "Hook run at the end of loading library `bookmark.el'.")
 
 ;; Exit Hook, called from kill-emacs-hook
 (defvar bookmark-exit-hook nil
--- a/lisp/doc-view.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/doc-view.el	Wed Jul 14 22:46:23 2010 +0000
@@ -1349,8 +1349,8 @@
 
 ;;;; Bookmark integration
 
-(declare-function bookmark-make-record-default "bookmark"
-                  (&optional point-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 
--- a/lisp/gnus/ChangeLog	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/gnus/ChangeLog	Wed Jul 14 22:46:23 2010 +0000
@@ -1,3 +1,29 @@
+2010-07-13  Thierry Volpiatto <thierry.volpiatto@gmail.com>
+
+	Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
+	Patch applied by Karl Fogel.
+
+	* gnus-sum.el (gnus-summary-bookmark-make-record): Set
+	`bookmark-yank-point' and `bookmark-current-buffer' to allow C-w.
+
+2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+	Allow bookmarks to be set from Gnus Article buffers (Bug #5975).
+	Patch applied (with minor tweaks) by Karl Fogel.  Note this leaves
+	C-w still not working correctly from Article buffers; Thierry's
+	patch to fix that will be applied after this.
+
+	* gnus-art.el (bookmark-make-record-function): New local variable.
+
+	* gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting
+	from article buffer.
+	(gnus-summary-bookmark-jump): Maybe jump to article buffer.
+
+2010-07-13  Karl Fogel  <kfogel@red-bean.com>
+
+	* gnus/gnus-sum.el (bookmark-make-record-default): Adjust
+	declaration, based on changes in bookmark.el.
+
 2010-06-22  Mark A. Hershberger  <mah@everybody.org>
 
 	* mm-url.el (mm-url-encode-multipart-form-data): New function to handle
--- a/lisp/gnus/gnus-art.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/gnus/gnus-art.el	Wed Jul 14 22:46:23 2010 +0000
@@ -4452,6 +4452,8 @@
   (make-local-variable 'gnus-article-image-alist)
   (make-local-variable 'gnus-article-charset)
   (make-local-variable 'gnus-article-ignored-charsets)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'gnus-summary-bookmark-make-record)
   ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space'
   ;; face.
   (set (make-local-variable 'nobreak-char-display) nil)
--- a/lisp/gnus/gnus-sum.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/gnus/gnus-sum.el	Wed Jul 14 22:46:23 2010 +0000
@@ -12621,25 +12621,34 @@
     (gnus-summary-position-point)))
 
 ;;; Bookmark support for Gnus.
-(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
 
 (defun gnus-summary-bookmark-make-record ()
   "Make a bookmark entry for a Gnus summary buffer."
-  (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
-    (error "Please retry from the Gnus summary buffer")) ;[1]
-  (let* ((subject (elt (gnus-summary-article-header) 1))
-         (grp     (car gnus-article-current))
-         (art     (cdr gnus-article-current))
-         (head    (gnus-summary-article-header art))
-         (id      (mail-header-id head)))
-    `(,subject
-      ,@(bookmark-make-record-default 'point-only)
-      (location . ,(format "Gnus %s:%d:%s" grp art id))
-      (group . ,grp) (article . ,art)
-      (message-id . ,id) (handler . gnus-summary-bookmark-jump))))
+  (let (pos buf)
+    (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
+      (save-restriction              ; FIXME is it necessary to widen?
+        (widen) (setq pos (point))) ; Set position in gnus-article buffer.
+      (setq buf "art") ; We are recording bookmark from article buffer.
+      (setq bookmark-yank-point (point))
+      (setq bookmark-current-buffer (current-buffer))
+      (gnus-article-show-summary))      ; Go back in summary buffer.
+    ;; We are now recording bookmark from summary buffer.
+    (unless buf (setq buf "sum"))
+    (let* ((subject (elt (gnus-summary-article-header) 1))
+           (grp     (car gnus-article-current))
+           (art     (cdr gnus-article-current))
+           (head    (gnus-summary-article-header art))
+           (id      (mail-header-id head)))
+      `(,subject
+        ,@(bookmark-make-record-default 'no-file 'no-context pos)
+        (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
+        (group . ,grp) (article . ,art)
+        (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
 
 ;;;###autoload
 (defun gnus-summary-bookmark-jump (bookmark)
@@ -12647,10 +12656,18 @@
 BOOKMARK is a bookmark name or a bookmark record."
   (let ((group    (bookmark-prop-get bookmark 'group))
         (article  (bookmark-prop-get bookmark 'article))
-        (id       (bookmark-prop-get bookmark 'message-id)))
+        (id       (bookmark-prop-get bookmark 'message-id))
+        (buf      (car (split-string (bookmark-prop-get bookmark 'location)))))
     (gnus-fetch-group group (list article))
     (gnus-summary-insert-cached-articles)
     (gnus-summary-goto-article id nil 'force)
+    ;; FIXME we have to wait article buffer is ready (only large buffer)
+    ;; Is there a better solution to know that?
+    ;; If we don't wait `bookmark-default-handler' will have no chance
+    ;; to set position. However there is no error, just wrong pos.
+    (sit-for 1)
+    (when (string= buf "Gnus-art")
+      (other-window 1))
     (bookmark-default-handler
      `(""
        (buffer . ,(current-buffer))
--- a/lisp/image-mode.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/image-mode.el	Wed Jul 14 22:46:23 2010 +0000
@@ -516,8 +516,8 @@
 
 
 ;;; Support for bookmark.el
-(declare-function bookmark-make-record-default "bookmark"
-                  (&optional point-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 
--- a/lisp/info.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/info.el	Wed Jul 14 22:46:23 2010 +0000
@@ -4901,7 +4901,8 @@
 	     '(Info-mode . Info-restore-desktop-buffer))
 
 ;;;; Bookmark support
-(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
@@ -4910,7 +4911,7 @@
   "This implements the `bookmark-make-record-function' type (which see)
 for Info nodes."
   `(,Info-current-node
-    ,@(bookmark-make-record-default 'point-only)
+    ,@(bookmark-make-record-default 'no-file)
     (filename . ,Info-current-file)
     (info-node . ,Info-current-node)
     (handler . Info-bookmark-jump)))
--- a/lisp/man.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/man.el	Wed Jul 14 22:46:23 2010 +0000
@@ -1674,7 +1674,8 @@
     complete-path))
 
 ;;; Bookmark Man Support
-(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
@@ -1691,7 +1692,7 @@
 (defun Man-bookmark-make-record ()
   "Make a bookmark entry for a Man buffer."
   `(,(Man-default-bookmark-title)
-    ,@(bookmark-make-record-default 'point-only)
+    ,@(bookmark-make-record-default 'no-file)
     (location . ,(concat "man " Man-arguments))
     (man-args . ,Man-arguments)
     (handler . Man-bookmark-jump)))
--- a/lisp/menu-bar.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/menu-bar.el	Wed Jul 14 22:46:23 2010 +0000
@@ -526,17 +526,6 @@
   "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
 Do the same for the keys of the same name."
   (interactive)
-  ;; We can't use constant list structure here because it becomes pure,
-  ;; and because it gets modified with cache data.
-  (define-key menu-bar-edit-menu [paste]
-    (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
-  (define-key menu-bar-edit-menu [copy]
-    (cons "Copy" (cons "Copy text in region to the clipboard"
-		       'clipboard-kill-ring-save)))
-  (define-key menu-bar-edit-menu [cut]
-    (cons "Cut" (cons "Delete text in region and copy it to the clipboard"
-		      'clipboard-kill-region)))
-
   ;; These are Sun server keysyms for the Cut, Copy and Paste keys
   ;; (also for XFree86 on Sun keyboard):
   (define-key global-map [f20] 'clipboard-kill-region)
--- a/lisp/mouse.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/mouse.el	Wed Jul 14 22:46:23 2010 +0000
@@ -41,7 +41,7 @@
   :type 'boolean
   :group 'mouse)
 
-(defcustom mouse-drag-copy-region t
+(defcustom mouse-drag-copy-region nil
   "If non-nil, mouse drag copies region to kill-ring."
   :type 'boolean
   :version "22.1"
@@ -2443,7 +2443,7 @@
 (global-set-key [left-fringe mouse-1]	'mouse-set-point)
 (global-set-key [right-fringe mouse-1]	'mouse-set-point)
 
-(global-set-key [mouse-2]	'mouse-yank-at-click)
+(global-set-key [mouse-2]	'mouse-yank-primary)
 ;; Allow yanking also when the corresponding cursor is "in the fringe".
 (global-set-key [right-fringe mouse-2] 'mouse-yank-at-click)
 (global-set-key [left-fringe mouse-2] 'mouse-yank-at-click)
--- a/lisp/simple.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/simple.el	Wed Jul 14 22:46:23 2010 +0000
@@ -3666,7 +3666,7 @@
       (marker-position (mark-marker))
     (signal 'mark-inactive nil)))
 
-(defcustom select-active-regions nil
+(defcustom select-active-regions t
   "If non-nil, an active region automatically becomes the window selection."
   :type 'boolean
   :group 'killing
@@ -3687,6 +3687,7 @@
 	 mark-active
 	 (display-selections-p)
 	 (x-selection-owner-p 'PRIMARY)
+	 (not (eq (region-beginning) (region-end)))
 	 (x-set-selection 'PRIMARY (buffer-substring-no-properties
 				    (region-beginning) (region-end))))
     (if (and (null force)
@@ -3819,6 +3820,8 @@
 	(push-mark nil nomsg t)
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)
+      (and select-active-regions (display-selections-p)
+	   (x-set-selection 'PRIMARY (current-buffer)))
       (unless nomsg
 	(message "Mark activated")))))
 
--- a/lisp/term/x-win.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/term/x-win.el	Wed Jul 14 22:46:23 2010 +0000
@@ -1219,13 +1219,9 @@
   "Max number of characters to put in the cut buffer.
 It is said that overlarge strings are slow to put into the cut buffer.")
 
-(defcustom x-select-enable-clipboard nil
+(defcustom x-select-enable-clipboard t
   "Non-nil means cutting and pasting uses the clipboard.
-This is in addition to, but in preference to, the primary selection.
-
-On MS-Windows, this is non-nil by default, since Windows does not
-support other types of selections.  \(The primary selection that is
-set by Emacs is not accessible to other programs on Windows.\)"
+This is in addition to, but in preference to, the primary selection."
   :type 'boolean
   :group 'killing)
 
@@ -1560,12 +1556,12 @@
   ;; Enable CLIPBOARD copy/paste through menu bar commands.
   (menu-bar-enable-clipboard)
 
-  ;; Override Paste so it looks at CLIPBOARD first.
-  (define-key menu-bar-edit-menu [paste]
-    (append '(menu-item "Paste" x-clipboard-yank
-			:enable (not buffer-read-only)
-			:help "Paste (yank) text most recently cut/copied")
-	    nil))
+  ;; ;; Override Paste so it looks at CLIPBOARD first.
+  ;; (define-key menu-bar-edit-menu [paste]
+  ;;   (append '(menu-item "Paste" x-clipboard-yank
+  ;; 			:enable (not buffer-read-only)
+  ;; 			:help "Paste (yank) text most recently cut/copied")
+  ;; 	    nil))
 
   (setq x-initialized t))
 
--- a/lisp/woman.el	Tue Jul 13 22:45:58 2010 +0000
+++ b/lisp/woman.el	Wed Jul 14 22:46:23 2010 +0000
@@ -4521,7 +4521,8 @@
   nil)					; for woman-file-readable-p etc.
 
 ;;; Bookmark Woman support.
-(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
 (declare-function bookmark-default-handler "bookmark" (bmk))
 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
@@ -4532,7 +4533,7 @@
 (defun woman-bookmark-make-record ()
   "Make a bookmark entry for a Woman buffer."
   `(,(Man-default-bookmark-title)
-    ,@(bookmark-make-record-default 'point-only)
+    ,@(bookmark-make-record-default 'no-file)
     (location . ,(concat "woman " woman-last-file-name))
     ;; Use the same form as man's bookmarks, as much as possible.
     (man-args . ,woman-last-file-name)
--- a/src/ChangeLog	Tue Jul 13 22:45:58 2010 +0000
+++ b/src/ChangeLog	Wed Jul 14 22:46:23 2010 +0000
@@ -1,3 +1,30 @@
+2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype.
+	(SET_SAVED_KEY_EVENT): Remove (not used).
+	(SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and
+	remove size parameter.
+	(handle_one_xevent): Check popup_activated () for menu for Xt also.
+	Remove #ifdef USE_GTK around finish = X_EVENT_DROP.
+	Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for
+	ButtonRelease.
+	(x_set_window_size_1): scroll_bar_actual_width is always
+	SCROLL_BAR_COLS * COLUMN_WIDTH for the purpose of frame sizing.
+
+	* xdisp.c (pending_menu_activation): Remove extern declaration.
+	(prepare_menu_bars): Remove setting of pending_menu_activation.
+
+	* xmenu.c (pending_menu_activation): Remove.
+	(x_activate_menubar): Set popup_activated_flag for Xt also. Remove
+	setting of pending_menu_activation.
+	(set_frame_menubar): Remove check of pending_menu_activation.
+	Declare menubar_size before code.  Correct spelling in comment.
+
+2010-07-14  Kenichi Handa  <handa@m17n.org>
+
+	* font.c (font_open_entity): Cancel previous change.
+	(Ffont_get): Don't check FONT_ENTITY_INDEX of a font-object.
+
 2010-07-13  Eli Zaretskii  <eliz@gnu.org>
 
 	Remove subprocesses #ifdefs.
--- a/src/font.c	Tue Jul 13 22:45:58 2010 +0000
+++ b/src/font.c	Wed Jul 14 22:46:23 2010 +0000
@@ -3005,7 +3005,6 @@
     return Qnil;
   ASET (entity, FONT_OBJLIST_INDEX,
 	Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
-  ASET (font_object, FONT_ENTITY_INDEX, entity);
   num_fonts++;
 
   font = XFONT_OBJECT (font_object);
@@ -4131,20 +4130,12 @@
   if (NILP (val) && EQ (key, QCotf) && FONT_OBJECT_P (font))
     {
       struct font *fontp = XFONT_OBJECT (font);
-      Lisp_Object entity = AREF (font, FONT_ENTITY_INDEX);
-
-      val = Fassq (key, AREF (entity, FONT_EXTRA_INDEX));
-      if (NILP (val))
-	{
-	  if (fontp->driver->otf_capability)
-	    val = fontp->driver->otf_capability (fontp);
-	  else
-	    val = Fcons (Qnil, Qnil);
-	  font_put_extra (font, QCotf, val);
-	  font_put_extra (entity, QCotf, val);
-	}
+
+      if (fontp->driver->otf_capability)
+	val = fontp->driver->otf_capability (fontp);
       else
-	val = Fcdr (val);
+	val = Fcons (Qnil, Qnil);
+      font_put_extra (font, QCotf, val);
     }
   else
     val = Fcdr (val);
--- a/src/xdisp.c	Tue Jul 13 22:45:58 2010 +0000
+++ b/src/xdisp.c	Wed Jul 14 22:46:23 2010 +0000
@@ -271,7 +271,6 @@
 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
     || defined(HAVE_NS) || defined (USE_GTK)
 extern void set_frame_menubar (struct frame *f, int, int);
-extern int pending_menu_activation;
 #endif
 
 extern int interrupt_input;
@@ -9866,12 +9865,6 @@
       update_tool_bar (sf, 1);
 #endif
     }
-
-  /* Motif needs this.  See comment in xmenu.c.  Turn it off when
-     pending_menu_activation is not defined.  */
-#ifdef USE_X_TOOLKIT
-  pending_menu_activation = 0;
-#endif
 }
 
 
--- a/src/xmenu.c	Tue Jul 13 22:45:58 2010 +0000
+++ b/src/xmenu.c	Wed Jul 14 22:46:23 2010 +0000
@@ -151,14 +151,6 @@
 extern widget_value *digest_single_submenu (int, int, int);
 #endif
 
-/* This is set nonzero after the user activates the menu bar, and set
-   to zero again after the menu bars are redisplayed by prepare_menu_bar.
-   While it is nonzero, all calls to set_frame_menubar go deep.
-
-   I don't understand why this is needed, but it does seem to be
-   needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>.  */
-
-int pending_menu_activation;
 
 #ifdef USE_X_TOOLKIT
 
@@ -670,6 +662,7 @@
 
   set_frame_menubar (f, 0, 1);
   BLOCK_INPUT;
+  popup_activated_flag = 1;
 #ifdef USE_GTK
   /* If we click outside any menu item, the menu bar still grabs.
      So we send Press and the Release.  If outside, grab is released.
@@ -681,15 +674,10 @@
   f->output_data.x->saved_menu_event->type = ButtonPress;
   XPutBackEvent (f->output_data.x->display_info->display,
                  f->output_data.x->saved_menu_event);
-  popup_activated_flag = 1;
 #else
   XtDispatchEvent (f->output_data.x->saved_menu_event);
 #endif
   UNBLOCK_INPUT;
-#ifdef USE_MOTIF
-  if (f->output_data.x->saved_menu_event->type == ButtonRelease)
-    pending_menu_activation = 1;
-#endif
 
   /* Ignore this if we get it a second time.  */
   f->output_data.x->saved_menu_event->type = 0;
@@ -991,8 +979,6 @@
 
   if (! menubar_widget)
     deep_p = 1;
-  else if (pending_menu_activation && !deep_p)
-    deep_p = 1;
   /* Make the first call for any given frame always go deep.  */
   else if (!f->output_data.x->saved_menu_event && !deep_p)
     {
@@ -1274,10 +1260,11 @@
     }
 
   {
+    int menubar_size;
     if (f->output_data.x->menubar_widget)
       XtRealizeWidget (f->output_data.x->menubar_widget);
 
-    int menubar_size
+    menubar_size
       = (f->output_data.x->menubar_widget
 	 ? (f->output_data.x->menubar_widget->core.height
 	    + f->output_data.x->menubar_widget->core.border_width)
@@ -1286,7 +1273,7 @@
 #if 1 /* Experimentally, we now get the right results
 	 for -geometry -0-0 without this.  24 Aug 96, rms.
          Maybe so, but the menu bar size is missing the pixels so the
-         WM size hints are off by theses pixel.  Jan D, oct 2009.  */
+         WM size hints are off by these pixels.  Jan D, oct 2009.  */
 #ifdef USE_LUCID
     if (FRAME_EXTERNAL_MENU_BAR (f))
       {
--- a/src/xterm.c	Tue Jul 13 22:45:58 2010 +0000
+++ b/src/xterm.c	Wed Jul 14 22:46:23 2010 +0000
@@ -4159,9 +4159,7 @@
    CALL_DATA is a pointer to a XmScrollBarCallbackStruct.  */
 
 static void
-xm_scroll_callback (widget, client_data, call_data)
-     Widget widget;
-     XtPointer client_data, call_data;
+xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
   XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data;
@@ -5546,22 +5544,18 @@
 
 static struct x_display_info *next_noop_dpyinfo;
 
-#define SET_SAVED_MENU_EVENT(size)					\
+#define SET_SAVED_BUTTON_EVENT                                          \
      do									\
        {								\
 	 if (f->output_data.x->saved_menu_event == 0)			\
            f->output_data.x->saved_menu_event				\
 	     = (XEvent *) xmalloc (sizeof (XEvent));			\
-         memcpy (f->output_data.x->saved_menu_event, &event, size);	\
+         *f->output_data.x->saved_menu_event = event;                   \
 	 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;			\
 	 XSETFRAME (inev.ie.frame_or_window, f);			\
        }								\
      while (0)
 
-#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
-#define SET_SAVED_KEY_EVENT    SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
-
-
 enum
 {
   X_EVENT_NORMAL,
@@ -6755,14 +6749,12 @@
            Instead, save it away
            and we will pass it to Xt from kbd_buffer_get_event.
            That way, we can run some Lisp code first.  */
-        if (
+        if (! popup_activated ()
 #ifdef USE_GTK
-            ! popup_activated ()
             /* Gtk+ menus only react to the first three buttons. */
             && event.xbutton.button < 3
-            &&
-#endif
-            f && event.type == ButtonPress
+#endif
+            && f && event.type == ButtonPress
             /* Verify the event is really within the menu bar
                and not just sent to it due to grabbing.  */
             && event.xbutton.x >= 0
@@ -6773,30 +6765,13 @@
           {
             SET_SAVED_BUTTON_EVENT;
             XSETFRAME (last_mouse_press_frame, f);
-#ifdef USE_GTK
             *finish = X_EVENT_DROP;
-#endif
           }
         else if (event.type == ButtonPress)
           {
             last_mouse_press_frame = Qnil;
             goto OTHER;
           }
-
-#ifdef USE_MOTIF /* This should do not harm for Lucid,
-		    but I am trying to be cautious.  */
-        else if (event.type == ButtonRelease)
-          {
-            if (!NILP (last_mouse_press_frame))
-              {
-                f = XFRAME (last_mouse_press_frame);
-                if (f->output_data.x)
-                  SET_SAVED_BUTTON_EVENT;
-              }
-            else
-              goto OTHER;
-          }
-#endif /* USE_MOTIF */
         else
           goto OTHER;
 #endif /* USE_X_TOOLKIT || USE_GTK */
@@ -8631,9 +8606,7 @@
   f->scroll_bar_actual_width
     = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
        ? 0
-       : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
-       ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
-       : (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)));
+       : FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f));
 
   compute_fringe_widths (f, 0);
 
@@ -10336,8 +10309,7 @@
    that slows us down.  */
 
 static void
-x_process_timeouts (timer)
-     struct atimer *timer;
+x_process_timeouts (struct atimer *timer)
 {
   BLOCK_INPUT;
   x_timeout_atimer_activated_flag = 0;