changeset 109444:11d5817a8846

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Fri, 16 Jul 2010 12:36:52 +0000
parents f1045a53471c (current diff) 9e514d1076b4 (diff)
children d92d0e17a7ce
files
diffstat 22 files changed, 348 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Wed Jul 14 13:03:03 2010 +0000
+++ b/etc/NEWS	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/ChangeLog	Fri Jul 16 12:36:52 2010 +0000
@@ -1,3 +1,73 @@
+2010-07-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
+	"/bin/sh" but `tramp-remote-sh' from `tramp-methods'.
+	(tramp-find-shell): Simplify setting connection property.
+	(tramp-get-ls-command): Make test for "--color=never" stronger.
+
+2010-07-15  Simon South  <ssouth@member.fsf.org>
+
+	* progmodes/delphi.el (delphi-previous-indent-of): Indent case
+	blocks within record declarations (i.e. variant parts) correctly.
+
+2010-07-15  Simon South  <ssouth@member.fsf.org>
+
+	* progmodes/delphi.el (delphi-token-at): Give newlines precedence
+	over literal tokens when parsing so newlines aren't "absorbed" by
+	single-line comments.  Corrects the indentation of case blocks
+	that have a comment on the first line.
+
+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 +75,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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/bookmark.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/doc-view.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/gnus/ChangeLog	Fri Jul 16 12:36:52 2010 +0000
@@ -1,3 +1,34 @@
+2010-07-15  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-sum.el (gnus-summary-bookmark-make-record): Make it work for
+	Emacs 23 as well.
+
+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-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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/gnus/gnus-art.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/gnus/gnus-sum.el	Fri Jul 16 12:36:52 2010 +0000
@@ -12621,25 +12621,37 @@
     (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
+	,@(condition-case nil
+	      (bookmark-make-record-default 'no-file 'no-context (point))
+	    (wrong-number-of-arguments
+	     (bookmark-make-record-default 'point-only)))
+        (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 +12659,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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/image-mode.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/info.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/man.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/menu-bar.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/mouse.el	Fri Jul 16 12:36:52 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/net/tramp.el	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/net/tramp.el	Fri Jul 16 12:36:52 2010 +0000
@@ -4683,7 +4683,12 @@
   (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
 	 ;; We cannot use `shell-file-name' and `shell-command-switch',
 	 ;; they are variables of the local host.
-	 (args (list "/bin/sh" "-c" (substring command 0 asynchronous)))
+	 (args (list
+		(tramp-get-method-parameter
+		 (tramp-file-name-method
+		  (tramp-dissect-file-name default-directory))
+		 'tramp-remote-sh)
+		"-c" (substring command 0 asynchronous)))
 	 current-buffer-p
 	 (output-buffer
 	  (cond
@@ -6619,12 +6624,10 @@
 
 	 (t (tramp-message
 	     vec 5 "Remote `%s' groks tilde expansion, good"
-	     (tramp-get-method-parameter
-	      (tramp-file-name-method vec) 'tramp-remote-sh))
-	    (tramp-set-connection-property
-	     vec "remote-shell"
-	     (tramp-get-method-parameter
-	      (tramp-file-name-method vec) 'tramp-remote-sh))))))))
+	     (tramp-set-connection-property
+	      vec "remote-shell"
+	      (tramp-get-method-parameter
+	       (tramp-file-name-method vec) 'tramp-remote-sh)))))))))
 
 ;; ------------------------------------------------------------
 ;; -- Functions for establishing connection --
@@ -8316,10 +8319,13 @@
 	     ;; Check parameters.  On busybox, "ls" output coloring is
 	     ;; enabled by default sometimes.  So we try to disable it
 	     ;; when possible.  $LS_COLORING is not supported there.
+	     ;; Some "ls" versions are sensible wrt the order of
+	     ;; arguments, they fail when "-al" is after the
+	     ;; "--color=never" argument (for example on FreeBSD).
 	     (when (zerop (tramp-send-command-and-check
 			   vec (format "%s -lnd /" result)))
 	       (when (zerop (tramp-send-command-and-check
-			     vec (format "%s --color=never /" result)))
+			     vec (format "%s --color=never -al /" result)))
 		 (setq result (concat result " --color=never")))
 	       (throw 'ls-found result))
 	     (setq dl (cdr dl))))))
--- a/lisp/progmodes/delphi.el	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/progmodes/delphi.el	Fri Jul 16 12:36:52 2010 +0000
@@ -628,7 +628,9 @@
 (defun delphi-token-at (p)
   ;; Returns the token from parsing text at point p.
   (when (and (<= (point-min) p) (<= p (point-max)))
-     (cond ((delphi-literal-token-at p))
+     (cond ((delphi-char-token-at p ?\n 'newline))
+
+           ((delphi-literal-token-at p))
 
            ((delphi-space-token-at p))
 
@@ -638,7 +640,6 @@
            ((delphi-char-token-at p ?\) 'close-group))
            ((delphi-char-token-at p ?\[ 'open-group))
            ((delphi-char-token-at p ?\] 'close-group))
-           ((delphi-char-token-at p ?\n 'newline))
            ((delphi-char-token-at p ?\; 'semicolon))
            ((delphi-char-token-at p ?. 'dot))
            ((delphi-char-token-at p ?, 'comma))
@@ -888,7 +889,24 @@
           (setq token (delphi-block-start token)))
 
          ;; Regular block start found.
-         ((delphi-is token-kind delphi-block-statements) (throw 'done token))
+         ((delphi-is token-kind delphi-block-statements)
+          (throw 'done
+                 ;; As a special case, when a "case" block appears
+                 ;; within a record declaration (to denote a variant
+                 ;; part), the record declaration should be considered
+                 ;; the enclosing block.
+                 (if (eq 'case token-kind)
+                     (let ((enclosing-token
+                            (delphi-block-start token
+                                                'stop-on-class)))
+                       (if
+                           (eq 'record
+                               (delphi-token-kind enclosing-token))
+                           (if stop-on-class
+                               enclosing-token
+                             (delphi-previous-token enclosing-token))
+                         token))
+                   token)))
 
          ;; A class/record start also begins a block.
          ((delphi-composite-type-start token last-token)
@@ -1058,6 +1076,7 @@
         (token-kind nil)
         (from-kind (delphi-token-kind from-token))
         (last-colon nil)
+        (last-of nil)
         (last-token nil))
     (catch 'done
       (while token
@@ -1101,9 +1120,17 @@
          ;; Ignore whitespace.
          ((delphi-is token-kind delphi-whitespace))
 
-         ;; Remember any ':' we encounter, since that affects how we indent to
-         ;; a case statement.
-         ((eq 'colon token-kind) (setq last-colon token))
+         ;; Remember any "of" we encounter, since that affects how we
+         ;; indent to a case statement within a record declaration
+         ;; (i.e. a variant part).
+         ((eq 'of token-kind)
+          (setq last-of token))
+
+         ;; Remember any ':' we encounter (until we reach an "of"),
+         ;; since that affects how we indent to case statements in
+         ;; general.
+         ((eq 'colon token-kind)
+          (unless last-of (setq last-colon token)))
 
          ;; A case statement delimits a previous statement. We indent labels
          ;; specially.
--- a/lisp/simple.el	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/simple.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/term/x-win.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/lisp/woman.el	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/src/ChangeLog	Fri Jul 16 12:36:52 2010 +0000
@@ -1,3 +1,43 @@
+2010-07-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (free_frame_menubar): Only call x_set_window_size if
+	widget is non-null (Bug#6645).
+
+2010-07-15  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* xterm.c (x_fully_uncatch_errors, x_trace_wire, x_check_font):
+	Convert old-style definition.
+
+	* xmenu.c (create_and_show_popup_menu, xmenu_show): Fix type of
+	timestamp argument.
+
+2010-07-15  Eli Zaretskii  <eliz@gnu.org>
+
+	* fringe.c (update_window_fringes): Restore mistakenly reverted
+	code from revno 99854.1.6 merged in revno 99950.
+
+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.
--- a/src/fringe.c	Wed Jul 14 13:03:03 2010 +0000
+++ b/src/fringe.c	Fri Jul 16 12:36:52 2010 +0000
@@ -1196,7 +1196,8 @@
 	  if (bot_ind_max_y >= 0)
 	    left_offset = bot_ind_max_y - (row->y + row->visible_height);
 	}
-      else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
+      else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))
+	       || (row->reversed_p && row->continued_p))
 	left = LEFT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
 	left = LEFT_FRINGE (5, Qempty_line, 0);
@@ -1240,7 +1241,8 @@
 	  if (bot_ind_max_y >= 0)
 	    right_offset = bot_ind_max_y - (row->y + row->visible_height);
 	}
-      else if (row->continued_p)
+      else if ((!row->reversed_p && row->continued_p)
+	       || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)))
 	right = RIGHT_FRINGE (4, Qcontinuation, 0);
       else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
 	{
--- a/src/xdisp.c	Wed Jul 14 13:03:03 2010 +0000
+++ b/src/xdisp.c	Fri Jul 16 12:36:52 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	Wed Jul 14 13:03:03 2010 +0000
+++ b/src/xmenu.c	Fri Jul 16 12:36:52 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))
       {
@@ -1368,15 +1355,15 @@
       lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
       f->output_data.x->menubar_widget = NULL;
 
-#ifdef USE_MOTIF
       if (f->output_data.x->widget)
 	{
+#ifdef USE_MOTIF
 	  XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
 	  if (x1 == 0 && y1 == 0)
 	    XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
+#endif
+          x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
 	}
-#endif
-      x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
       UNBLOCK_INPUT;
     }
 }
@@ -1575,7 +1562,8 @@
    menu pops down.
    menu_item_selection will be set to the selection.  */
 static void
-create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, unsigned int timestamp)
+create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
+			    int x, int y, int for_click, EMACS_UINT timestamp)
 {
   int i;
   Arg av[2];
@@ -2288,7 +2276,8 @@
 
 
 Lisp_Object
-xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, Lisp_Object title, char **error, unsigned int timestamp)
+xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
+	    Lisp_Object title, char **error, EMACS_UINT timestamp)
 {
   Window root;
   XMenu *menu;
--- a/src/xterm.c	Wed Jul 14 13:03:03 2010 +0000
+++ b/src/xterm.c	Fri Jul 16 12:36:52 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 */
@@ -7528,7 +7503,7 @@
 /* Close off all unclosed x_catch_errors calls.  */
 
 void
-x_fully_uncatch_errors ()
+x_fully_uncatch_errors (void)
 {
   while (x_error_message)
     x_uncatch_errors ();
@@ -7545,7 +7520,7 @@
 
 #if 0
 static unsigned int x_wire_count;
-x_trace_wire ()
+x_trace_wire (void)
 {
   fprintf (stderr, "Lib call: %d\n", ++x_wire_count);
 }
@@ -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);
 
@@ -9587,9 +9560,7 @@
    font table.  */
 
 static void
-x_check_font (f, font)
-     struct frame *f;
-     struct font *font;
+x_check_font (struct frame *f, struct font *font)
 {
   Lisp_Object frame;
 
@@ -10336,8 +10307,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;