changeset 108454:fada58304621

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Fri, 23 Apr 2010 22:30:27 +0000
parents 6ebf8ca9708b (current diff) 783e1b7c827d (diff)
children 2d8a4d786871
files
diffstat 36 files changed, 355 insertions(+), 251 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 22 12:19:18 2010 +0000
+++ b/ChangeLog	Fri Apr 23 22:30:27 2010 +0000
@@ -1,7 +1,11 @@
-2010-04-22  Miles Bader  <Miles Bader <miles@gnu.org>>
+2010-04-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* configure.in (REAL_CFLAGS, CFLAGS): Restore -g for gcc.
+
+2010-04-22  Miles Bader <miles@gnu.org>
 
 	* configure.in: Get rid of "unix" pre-defined macro when
-	preprocessing Makefile.
+	preprocessing Makefile.  (Bug#5857)
 
 2010-04-21  Andreas Schwab  <schwab@linux-m68k.org>
 
--- a/configure	Thu Apr 22 12:19:18 2010 +0000
+++ b/configure	Fri Apr 23 22:30:27 2010 +0000
@@ -5477,7 +5477,7 @@
 
 /* Get the CFLAGS for tests in configure.  */
 #ifdef __GNUC__
-configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
 #else
 configure___ CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
@@ -5486,7 +5486,7 @@
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
-configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
+configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
 #else
 configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
@@ -7510,7 +7510,6 @@
 main ()
 {
   char *data, *data2, *data3;
-  const char *cdata2;
   int i, pagesize;
   int fd, fd2;
 
@@ -7535,10 +7534,10 @@
   fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
   if (fd2 < 0)
     return 4;
-  cdata2 = "";
-  if (write (fd2, cdata2, 1) != 1)
+  data2 = "";
+  if (write (fd2, data2, 1) != 1)
     return 5;
-  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  data2 = mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
   if (data2 == MAP_FAILED)
     return 6;
   for (i = 0; i < pagesize; ++i)
--- a/configure.in	Thu Apr 22 12:19:18 2010 +0000
+++ b/configure.in	Fri Apr 23 22:30:27 2010 +0000
@@ -917,7 +917,7 @@
 
 /* Get the CFLAGS for tests in configure.  */
 #ifdef __GNUC__
-configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
 #else
 configure___ CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
@@ -926,7 +926,7 @@
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
-configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
+configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
 #else
 configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
--- a/etc/NEWS	Thu Apr 22 12:19:18 2010 +0000
+++ b/etc/NEWS	Fri Apr 23 22:30:27 2010 +0000
@@ -69,7 +69,7 @@
 Use `set-scroll-bar-mode' to change this.
 
 ** GTK tool bars can have just text, just images or images and text.
-Customize `tool-bar-style´ to choose style.  On a Gnome desktop, the default
+Customize `tool-bar-style' to choose style.  On a Gnome desktop, the default
 is taken from the desktop settings.
 
 ** Lucid menus and dialogs can display antialiased fonts if Emacs is built
@@ -78,11 +78,17 @@
 ** Basic SELinux support has been added.
 This requires Emacs to be linked with libselinux at build time.
 
-*** Emacs preserves the SELinux file context when backing up or copying files.
+*** Emacs preserves the SELinux file context when backing up, and
+optionally when copying files. To this end, copy-file has an extra
+optional argument, and backup-buffer and friends include the SELinux
+context in their return values.
 
 *** The new functions file-selinux-context and set-file-selinux-context
 get and set the SELinux context of a file.
 
+*** Tramp offers handlers for file-selinux-context and set-file-selinux-context
+for remote machines which support SELinux.
+
 ** New scrolling commands `scroll-up-command' and `scroll-down-command'
 (bound to C-v/[next] and M-v/[prior]) does not signal errors at top/bottom
 of buffer at first key-press (instead moves to top/bottom of buffer)
@@ -138,8 +144,7 @@
 
 ** Directory local variables can apply to file-less buffers.
 For example, adding "(diff-mode . ((mode . whitespace)))" to your
-.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff*
-buffers.
+.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers.
 
 ** s-region.el is now declared obsolete, superceded by shift-select-mode
 enabled by default in 23.1.
--- a/lisp/ChangeLog	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/ChangeLog	Fri Apr 23 22:30:27 2010 +0000
@@ -1,3 +1,35 @@
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/bytecomp.el (byte-compile-set-default): New function.
+	(byte-compile-setq-default): Optimize for the
+	single-var case and don't call byte-compile-form in this case to avoid
+	inf-loop with byte-compile-set-default.
+
+	* progmodes/compile.el (compilation-start): Abbreviate default directory.
+
+2010-04-23  Michael Albinus  <michael.albinus@gmx.de>
+
+	Implement SELINUX backends.
+
+	* net/tramp.el (tramp-file-name-handler-alist):
+	Add `file-selinux-context' and `set-file-selinux-context'.
+	(tramp-handle-file-selinux-context)
+	(tramp-handle-set-file-selinux-context): New defuns.
+	(tramp-handle-copy-file, tramp-do-copy-or-rename-file):
+	Handle PRESERVE-SELINUX-CONTEXT.
+
+	* net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
+	Add `file-selinux-context' and `set-file-selinux-context'.
+	(tramp-gvfs-handle-file-selinux-context)
+	(tramp-gvfs-handle-set-file-selinux-context): New defuns.
+	(tramp-gvfs-handle-copy-file): Handle PRESERVE-SELINUX-CONTEXT.
+
+	* net/ange-ftp.el (ange-ftp-copy-file):
+	* net/tramp-fish.el (tramp-fish-handle-copy-file):
+	* net/tramp-imap.el (tramp-imap-handle-copy-file):
+	* net/tramp-smb.el (tramp-smb-handle-copy-file):
+	Add PRESERVE-SELINUX-CONTEXT.
+
 2010-04-22  Michael Albinus  <michael.albinus@gmx.de>
 
 	Synchronize with Tramp repository.
@@ -1433,7 +1465,7 @@
 	* image-mode.el (image-toggle-display-image):
 	Replace `create-image' with `create-animated-image'.
 
-2010-03-09  Miles Bader  <Miles Bader <miles@gnu.org>>
+2010-03-09  Miles Bader  <miles@gnu.org>
 
 	* vc-git.el (vc-git-print-log): Use "tformat:" for shortlog,
 	instead of "format:"; this ensures that the output is
--- a/lisp/emacs-lisp/bytecomp.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Apr 23 22:30:27 2010 +0000
@@ -3333,21 +3333,31 @@
     (setq for-effect nil)))
 
 (defun byte-compile-setq-default (form)
-  (let ((bytecomp-args (cdr form))
-	setters)
-    (while bytecomp-args
-      (let ((var (car bytecomp-args)))
-	(and (or (not (symbolp var))
-		 (byte-compile-const-symbol-p var t))
-	     (byte-compile-warning-enabled-p 'constants)
-	     (byte-compile-warn
-	      "variable assignment to %s `%s'"
-	      (if (symbolp var) "constant" "nonvariable")
-	      (prin1-to-string var)))
-	(push (list 'set-default (list 'quote var) (car (cdr bytecomp-args)))
-	      setters))
-      (setq bytecomp-args (cdr (cdr bytecomp-args))))
-    (byte-compile-form (cons 'progn (nreverse setters)))))
+  (setq form (cdr form))
+  (if (> (length form) 2)
+      (let ((setters ()))
+        (while (consp form)
+          (push `(setq-default ,(pop form) ,(pop form)) setters))
+        (byte-compile-form (cons 'progn (nreverse setters))))
+    (let ((var (car form)))
+      (and (or (not (symbolp var))
+               (byte-compile-const-symbol-p var t))
+           (byte-compile-warning-enabled-p 'constants)
+           (byte-compile-warn
+            "variable assignment to %s `%s'"
+            (if (symbolp var) "constant" "nonvariable")
+            (prin1-to-string var)))
+      (byte-compile-normal-call `(set-default ',var ,@(cdr form))))))
+
+(byte-defop-compiler-1 set-default)
+(defun byte-compile-set-default (form)
+  (let ((varexp (car-safe (cdr-safe form))))
+    (if (eq (car-safe varexp) 'quote)
+        ;; If the varexp is constant, compile it as a setq-default
+        ;; so we get more warnings.
+        (byte-compile-setq-default `(setq-default ,(car-safe (cdr varexp))
+                                                  ,@(cddr form)))
+      (byte-compile-normal-call form))))
 
 (defun byte-compile-quote (form)
   (byte-compile-constant (car (cdr form))))
--- a/lisp/gnus/ChangeLog	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/gnus/ChangeLog	Fri Apr 23 22:30:27 2010 +0000
@@ -1,3 +1,8 @@
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* mm-util.el (mm-find-buffer-file-coding-system):
+	* yenc.el (yenc-decode-region): Don't let-bind a read-only variable.
+
 2010-04-22  Andreas Seltenreich  <seltenreich@gmx.de>
 
 	* message.el (message-generate-headers): Record insertion of optional
--- a/lisp/gnus/mm-util.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/gnus/mm-util.el	Fri Apr 23 22:30:27 2010 +0000
@@ -1239,6 +1239,9 @@
 harmful since it is likely to modify existing data in the buffer.
 For instance, it converts \"\\300\\255\" into \"\\255\" in
 Emacs 23 (unicode)."
+  ;; FIXME: (default-value 'enable-multibyte-characters) is read-only
+  ;; so let-binding it is wrong.  The right fix is to not use this
+  ;; macro at all any more, since it's been ill-defined from the start.
   (let ((multibyte (make-symbol "multibyte"))
 	(buffer (make-symbol "buffer")))
     `(if mm-emacs-mule
@@ -1593,8 +1596,8 @@
 			    filename))
 		    (mm-decompress-buffer filename nil t))))
       (when decomp
-	(set-buffer (letf (((default-value 'enable-multibyte-characters) nil))
-			  (generate-new-buffer " *temp*")))
+	(set-buffer (generate-new-buffer " *temp*"))
+        (mm-disable-multibyte)
 	(insert decomp)
 	(setq filename (file-name-sans-extension filename)))
       (goto-char (point-min))
--- a/lisp/gnus/yenc.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/gnus/yenc.el	Fri Apr 23 22:30:27 2010 +0000
@@ -89,8 +89,9 @@
 	      (when (re-search-forward "^=yend.*$" end t)
 		(setq last (match-beginning 0))
 		(setq footer-alist (yenc-parse-line (match-string 0)))
-		(letf (((default-value 'enable-multibyte-characters) nil))
-		      (setq work-buffer (generate-new-buffer " *yenc-work*")))
+                (with-current-buffer
+                    (setq work-buffer (generate-new-buffer " *yenc-work*"))
+                  (set-buffer-multibyte nil))
 		(while (< first last)
 		  (setq char (char-after first))
 		  (cond ((or (eq char ?\r)
--- a/lisp/net/ange-ftp.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/ange-ftp.el	Fri Apr 23 22:30:27 2010 +0000
@@ -3827,7 +3827,8 @@
     (ange-ftp-call-cont cont result line)))
 
 (defun ange-ftp-copy-file (filename newname &optional ok-if-already-exists
-				    keep-date preserve-uid-gid)
+				    keep-date preserve-uid-gid
+				    preserve-selinux-context)
   (interactive "fCopy file: \nFCopy %s to file: \np")
   (ange-ftp-copy-file-internal filename
 			       newname
--- a/lisp/net/tramp-fish.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/tramp-fish.el	Fri Apr 23 22:30:27 2010 +0000
@@ -217,7 +217,6 @@
     (file-executable-p . tramp-fish-handle-file-executable-p)
     (file-exists-p . tramp-fish-handle-file-exists-p)
     (file-local-copy . tramp-fish-handle-file-local-copy)
-    (file-remote-p . tramp-handle-file-remote-p)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-fish-handle-file-name-all-completions)
     (file-name-as-directory . tramp-handle-file-name-as-directory)
@@ -229,6 +228,8 @@
     (file-ownership-preserved-p . ignore)
     (file-readable-p . tramp-fish-handle-file-readable-p)
     (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    ;; `file-selinux-context' performed by default handler.
     (file-symlink-p . tramp-handle-file-symlink-p)
     ;; `file-truename' performed by default handler
     (file-writable-p . tramp-fish-handle-file-writable-p)
@@ -243,6 +244,7 @@
     (make-symbolic-link . tramp-fish-handle-make-symbolic-link)
     (rename-file . tramp-fish-handle-rename-file)
     (set-file-modes . tramp-fish-handle-set-file-modes)
+    ;; `set-file-selinux-context' performed by default handler.
     (set-file-times . tramp-fish-handle-set-file-times)
     (set-visited-file-modtime . ignore)
     (shell-command . tramp-handle-shell-command)
@@ -307,7 +309,8 @@
 	 v1 'file-error "Error with add-name-to-file %s" newname)))))
 
 (defun tramp-fish-handle-copy-file
-  (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  (filename newname &optional ok-if-already-exists keep-date
+	    preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files."
   (tramp-fish-do-copy-or-rename-file
    'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
--- a/lisp/net/tramp-gvfs.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/tramp-gvfs.el	Fri Apr 23 22:30:27 2010 +0000
@@ -386,7 +386,6 @@
     (file-executable-p . tramp-gvfs-handle-file-executable-p)
     (file-exists-p . tramp-gvfs-handle-file-exists-p)
     (file-local-copy . tramp-gvfs-handle-file-local-copy)
-    (file-remote-p . tramp-handle-file-remote-p)
     ;; `file-modes' performed by default handler.
     (file-name-all-completions . tramp-gvfs-handle-file-name-all-completions)
     (file-name-as-directory . tramp-handle-file-name-as-directory)
@@ -398,6 +397,8 @@
     (file-ownership-preserved-p . ignore)
     (file-readable-p . tramp-gvfs-handle-file-readable-p)
     (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    (file-selinux-context . tramp-gvfs-handle-file-selinux-context)
     (file-symlink-p . tramp-handle-file-symlink-p)
     ;; `file-truename' performed by default handler.
     (file-writable-p . tramp-gvfs-handle-file-writable-p)
@@ -413,6 +414,7 @@
     (process-file . tramp-gvfs-handle-process-file)
     (rename-file . tramp-gvfs-handle-rename-file)
     (set-file-modes . tramp-gvfs-handle-set-file-modes)
+    (set-file-selinux-context . tramp-gvfs-handle-set-file-selinux-context)
     (set-visited-file-modtime . tramp-gvfs-handle-set-visited-file-modtime)
     (shell-command . tramp-gvfs-handle-shell-command)
     (start-file-process . tramp-gvfs-handle-start-file-process)
@@ -510,16 +512,21 @@
 ;; File name primitives.
 
 (defun tramp-gvfs-handle-copy-file
-  (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  (filename newname &optional ok-if-already-exists keep-date
+	    preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files."
-  (copy-file
-   (if (tramp-gvfs-file-name-p filename)
-       (tramp-gvfs-fuse-file-name filename)
-     filename)
-   (if (tramp-gvfs-file-name-p newname)
-       (tramp-gvfs-fuse-file-name newname)
-     newname)
-   ok-if-already-exists keep-date preserve-uid-gid))
+  (let ((args
+	 (list
+	  (if (tramp-gvfs-file-name-p filename)
+	      (tramp-gvfs-fuse-file-name filename)
+	    filename)
+	  (if (tramp-gvfs-file-name-p newname)
+	      (tramp-gvfs-fuse-file-name newname)
+	    newname)
+	  ok-if-already-exists keep-date preserve-uid-gid)))
+    (when preserve-selinux-context
+      (setq args (append args (list preserve-uid-gid))))
+    (apply 'copy-file args)))
 
 (defun tramp-gvfs-handle-delete-directory (directory &optional recursive)
   "Like `delete-directory' for Tramp files."
@@ -620,6 +627,10 @@
   "Like `file-readable-p' for Tramp files."
   (file-readable-p (tramp-gvfs-fuse-file-name filename)))
 
+(defun tramp-gvfs-handle-file-selinux-context (filename)
+  "Like `file-selinux-context' for Tramp files."
+  (funcall 'file-selinux-context (tramp-gvfs-fuse-file-name filename)))
+
 (defun tramp-gvfs-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
   (file-writable-p (tramp-gvfs-fuse-file-name filename)))
@@ -682,6 +693,11 @@
   (with-tramp-gvfs-error-message filename 'set-file-modes
     (tramp-gvfs-fuse-file-name filename) mode))
 
+(defun tramp-gvfs-handle-set-file-selinux-context (filename context)
+  "Like `set-file-selinux-context' for Tramp files."
+  (with-tramp-gvfs-error-message filename 'set-file-selinux-context
+    (tramp-gvfs-fuse-file-name filename) context))
+
 (defun tramp-gvfs-handle-set-visited-file-modtime (&optional time-list)
   "Like `set-visited-file-modtime' for Tramp files."
   (let ((buffer-file-name (tramp-gvfs-fuse-file-name (buffer-file-name))))
--- a/lisp/net/tramp-imap.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/tramp-imap.el	Fri Apr 23 22:30:27 2010 +0000
@@ -124,7 +124,6 @@
     (file-executable-p . tramp-imap-handle-file-executable-p)
     (file-exists-p . tramp-imap-handle-file-exists-p)
     (file-local-copy . tramp-imap-handle-file-local-copy)
-    (file-remote-p . tramp-handle-file-remote-p)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-imap-handle-file-name-all-completions)
     (file-name-as-directory . tramp-handle-file-name-as-directory)
@@ -136,6 +135,8 @@
     (file-ownership-preserved-p . ignore)
     (file-readable-p . tramp-imap-handle-file-readable-p)
     (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    ;; `file-selinux-context' performed by default handler.
     (file-symlink-p . tramp-handle-file-symlink-p)
     ;; `file-truename' performed by default handler
     (file-writable-p . tramp-imap-handle-file-writable-p)
@@ -150,6 +151,7 @@
     (make-symbolic-link . ignore)
     (rename-file . tramp-imap-handle-rename-file)
     (set-file-modes . ignore)
+    ;; `set-file-selinux-context' performed by default handler.
     (set-file-times . ignore) ;; tramp-imap-handle-set-file-times)
     (set-visited-file-modtime . ignore)
     (shell-command . ignore)
@@ -200,7 +202,8 @@
 	     (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler))
 
 (defun tramp-imap-handle-copy-file
-  (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  (filename newname &optional ok-if-already-exists keep-date
+	    preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files."
   (tramp-imap-do-copy-or-rename-file
    'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
--- a/lisp/net/tramp-smb.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/tramp-smb.el	Fri Apr 23 22:30:27 2010 +0000
@@ -164,7 +164,6 @@
     (file-executable-p . tramp-smb-handle-file-exists-p)
     (file-exists-p . tramp-smb-handle-file-exists-p)
     (file-local-copy . tramp-smb-handle-file-local-copy)
-    (file-remote-p . tramp-handle-file-remote-p)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
     (file-name-as-directory . tramp-handle-file-name-as-directory)
@@ -176,6 +175,8 @@
     (file-ownership-preserved-p . ignore)
     (file-readable-p . tramp-smb-handle-file-exists-p)
     (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    ;; `file-selinux-context' performed by default handler.
     (file-symlink-p . tramp-handle-file-symlink-p)
     ;; `file-truename' performed by default handler.
     (file-writable-p . tramp-smb-handle-file-writable-p)
@@ -190,6 +191,7 @@
     (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
     (rename-file . tramp-smb-handle-rename-file)
     (set-file-modes . tramp-smb-handle-set-file-modes)
+    ;; `set-file-selinux-context' performed by default handler.
     (set-file-times . ignore)
     (set-visited-file-modtime . ignore)
     (shell-command . ignore)
@@ -325,7 +327,8 @@
 	 'copy-directory (list dirname newname keep-date parents)))))))
 
 (defun tramp-smb-handle-copy-file
-  (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  (filename newname &optional ok-if-already-exists keep-date
+	    preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files.
 KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
 PRESERVE-UID-GID is completely ignored."
--- a/lisp/net/tramp.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/net/tramp.el	Fri Apr 23 22:30:27 2010 +0000
@@ -2036,6 +2036,8 @@
     (dired-uncache . tramp-handle-dired-uncache)
     (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
     (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
+    (file-selinux-context . tramp-handle-file-selinux-context)
+    (set-file-selinux-context . tramp-handle-set-file-selinux-context)
     (vc-registered . tramp-handle-vc-registered))
   "Alist of handler functions.
 Operations not mentioned here will be handled by the normal Emacs functions.")
@@ -3028,6 +3030,46 @@
 	 "chown" nil nil nil
          (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))
 
+(defun tramp-handle-file-selinux-context (filename)
+  "Like `file-selinux-context' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-file-property v localname "file-selinux-context"
+      (let ((context '(nil nil nil nil))
+	    (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
+			    "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))
+	(when (zerop (tramp-send-command-and-check
+		      v (format
+			 "%s -d -Z %s"
+			 (tramp-get-ls-command v)
+			 (tramp-shell-quote-argument localname))))
+	  (with-current-buffer (tramp-get-connection-buffer v)
+	    (goto-char (point-min))
+	    (when (re-search-forward regexp (tramp-compat-line-end-position) t)
+	      (setq context (list (match-string 1) (match-string 2)
+				  (match-string 3) (match-string 4))))))
+	;; Return the context.
+	context))))
+
+(defun tramp-handle-set-file-selinux-context (filename context)
+  "Like `set-file-selinux-context' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (if (and (consp context)
+	     (zerop (tramp-send-command-and-check
+		     v (format "chcon %s %s %s %s %s"
+			       (if (stringp (nth 0 context))
+				   (format "--user=%s" (nth 0 context)) "")
+			       (if (stringp (nth 1 context))
+				   (format "--role=%s" (nth 1 context)) "")
+			       (if (stringp (nth 2 context))
+				   (format "--type=%s" (nth 2 context)) "")
+			       (if (stringp (nth 3 context))
+				   (format "--range=%s" (nth 3 context)) "")
+			       (tramp-shell-quote-argument localname)))))
+	(tramp-set-file-property v localname "file-selinux-context" context)
+      (tramp-set-file-property v localname "file-selinux-context" 'undef)))
+  ;; We always return nil.
+  nil)
+
 ;; Simple functions using the `test' command.
 
 (defun tramp-handle-file-executable-p (filename)
@@ -3473,8 +3515,6 @@
   (filename newname &optional ok-if-already-exists keep-date
 	    preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files."
-  ;; Check if both files are local -- invoke normal copy-file.
-  ;; Otherwise, use Tramp from local system.
   (setq filename (expand-file-name filename))
   (setq newname (expand-file-name newname))
   (cond
@@ -3482,8 +3522,14 @@
    ((or (tramp-tramp-file-p filename)
 	(tramp-tramp-file-p newname))
     (tramp-do-copy-or-rename-file
-     'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
+     'copy filename newname ok-if-already-exists keep-date
+     preserve-uid-gid preserve-selinux-context))
    ;; Compat section.
+   (preserve-selinux-context
+    (tramp-run-real-handler
+     'copy-file
+     (list filename newname ok-if-already-exists keep-date
+	   preserve-uid-gid preserve-selinux-context)))
    (preserve-uid-gid
     (tramp-run-real-handler
      'copy-file
@@ -3544,7 +3590,8 @@
      'rename-file (list filename newname ok-if-already-exists))))
 
 (defun tramp-do-copy-or-rename-file
-  (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  (op filename newname &optional ok-if-already-exists keep-date
+      preserve-uid-gid preserve-selinux-context)
   "Copy or rename a remote file.
 OP must be `copy' or `rename' and indicates the operation to perform.
 FILENAME specifies the file to copy or rename, NEWNAME is the name of
@@ -3553,6 +3600,7 @@
 KEEP-DATE means to make sure that NEWNAME has the same timestamp
 as FILENAME.  PRESERVE-UID-GID, when non-nil, instructs to keep
 the uid and gid if both files are on the same host.
+PRESERVE-SELINUX-CONTEXT activates selinux commands.
 
 This function is invoked by `tramp-handle-copy-file' and
 `tramp-handle-rename-file'.  It is an error if OP is neither of `copy'
@@ -3561,6 +3609,8 @@
     (error "Unknown operation `%s', must be `copy' or `rename'" op))
   (let ((t1 (tramp-tramp-file-p filename))
 	(t2 (tramp-tramp-file-p newname))
+	(context (and preserve-selinux-context
+		      (apply 'file-selinux-context (list filename))))
 	pr tm)
 
     (when (and (not ok-if-already-exists) (file-exists-p newname))
@@ -3628,6 +3678,9 @@
 	 ;; One of them must be a Tramp file.
 	 (error "Tramp implementation says this cannot happen")))
 
+       ;; Handle `preserve-selinux-context'.
+       (when context (apply 'set-file-selinux-context (list newname context)))
+
        ;; In case of `rename', we must flush the cache of the source file.
        (when (and t1 (eq op 'rename))
 	 (with-parsed-tramp-file-name filename v1
--- a/lisp/progmodes/compile.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/progmodes/compile.el	Fri Apr 23 22:30:27 2010 +0000
@@ -1265,7 +1265,8 @@
             (set (make-local-variable 'compilation-auto-jump-to-next) t))
 	;; Output a mode setter, for saving and later reloading this buffer.
 	(insert "-*- mode: " name-of-mode
-		"; default-directory: " (prin1-to-string default-directory)
+		"; default-directory: "
+                (prin1-to-string (abbreviate-file-name default-directory))
 		" -*-\n"
 		(format "%s started at %s\n\n"
 			mode-name
--- a/lisp/tool-bar.el	Thu Apr 22 12:19:18 2010 +0000
+++ b/lisp/tool-bar.el	Fri Apr 23 22:30:27 2010 +0000
@@ -232,6 +232,7 @@
 	 submap key)
     ;; We'll pick up the last valid entry in the list of keys if
     ;; there's more than one.
+    ;; FIXME: Aren't they *all* "valid"??  --Stef
     (dolist (k keys)
       ;; We're looking for a binding of the command in a submap of
       ;; the menu bar map, so the key sequence must be two or more
@@ -242,24 +243,24 @@
                 ;; Last element in the bound key sequence:
                 (kk (aref k (1- (length k)))))
             (if (and (keymapp m)
-                     (symbolp kk))
+                     (symbolp kk))      ;FIXME: Why?  --Stef
                 (setq submap m
                       key kk)))))
-    (when (and (symbolp submap) (boundp submap))
-      (setq submap (eval submap)))
-    (let ((defn (assq key (cdr submap))))
-      (if (eq (cadr defn) 'menu-item)
-          (define-key-after in-map (vector key)
-            (append (cdr defn) (list :image image-exp) props))
-        (setq defn (cdr defn))
+    (when submap
+      (let ((defn nil))
+        ;; Here, we're essentially doing a "lookup-key without get_keyelt".
+        (map-keymap (lambda (k b) (if (eq k key) (setq defn b)))
+                    submap)
         (define-key-after in-map (vector key)
-          (let ((rest (cdr defn)))
-            ;; If the rest of the definition starts
-            ;; with a list of menu cache info, get rid of that.
-            (if (and (consp rest) (consp (car rest)))
-                (setq rest (cdr rest)))
-            (append `(menu-item ,(car defn) ,rest)
-                    (list :image image-exp) props)))))))
+          (if (eq (car defn) 'menu-item)
+              (append (cdr defn) (list :image image-exp) props)
+            (let ((rest (cdr defn)))
+              ;; If the rest of the definition starts
+              ;; with a list of menu cache info, get rid of that.
+              (if (and (consp rest) (consp (car rest)))
+                  (setq rest (cdr rest)))
+              (append `(menu-item ,(car defn) ,rest)
+                      (list :image image-exp) props))))))))
 
 ;;; Set up some global items.  Additions/deletions up for grabs.
 
--- a/src/ChangeLog	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/ChangeLog	Fri Apr 23 22:30:27 2010 +0000
@@ -1,3 +1,79 @@
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* s/cygwin.h (LIBS_DEBUG): Remove, unused.
+
+	Remove redundant flags.
+	* s/freebsd.h (C_SWITCH_SYSTEM):
+	* s/hpux10-20.h (C_SWITCH_X_SYSTEM, LD_SWITCH_X_DEFAULT):
+	* s/netbsd.h (C_SWITCH_SYSTEM):
+	* s/openbsd.h (LD_SWITCH_X_DEFAULT): Remove, configure takes care
+	of these.
+
+	Simplify m/intel386.h.
+	* m/intel386.h (CRT0_DUMMIES): Remove, inline value in the only
+	user: ecrt0.c.
+	(SOLARIS2): Remove LOAD_AVE_TYPE, LOAD_AVE_CVT, LIBS_MACHINE, unused.
+	(USG5_4): Move LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE definitions to
+	the only user: s/unixware.h.
+	* ecrt0.c: Remove #ifndef static.  Inline CRT0_DUMMIES definition
+	from m/intel386.h.
+	* s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions
+	moved here from m/intel386.h.
+
+	* m/mips.h: Remove #if 0 code.
+
+2010-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+	Fix display of composed characters from L2R scripts in bidi buffers.
+	* xdisp.c (set_iterator_to_next, next_element_from_composition):
+	After advancing IT past the composition, resync the bidi iterator
+	with IT's position.  (Bug#5977)
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* Makefile.in (LD_SWITCH_MACHINE_TEMACS): Remove, unused.
+	(TEMACS_LDFLAGS): Don't use LD_SWITCH_SYSTEM_TEMACS.
+
+2010-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* gtkutil.c: Include xsettings.h for Ftool_bar_get_system_style.
+
+2010-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+	Support `display' text properties and overlay strings in bidi
+	buffers.
+	* xdisp.c (pop_it): When the stack is popped after displaying
+	from a string, bidi-iterate to exit from the text portion covered
+	by the `display' property or overlay.  (Bug#5988, bug#5920)
+
+2010-04-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* m/macppc.h (LD_SWITCH_SYSTEM_TEMACS): Remove #undef.
+	(LD_SWITCH_MACHINE_TEMACS): Remove, configure sets nocombreloc.
+
+	* s/netbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure sets nocombreloc.
+	* s/openbsd.h (LD_SWITCH_SYSTEM_TEMACS): Remove.
+
+	Simplify STARTFILES definition.
+	* s/hpux10-20.h (START_FILES): Explicitly define here instead of
+	relying on Makefile.in to define it.
+	* s/cygwin.h (START_FILES): Likewise.
+	* Makefile.in (STARTFILES): Remove conditional code, not needed anymore.
+
+	Clean up Solaris code.
+	* s/sol2-6.h (LD_SWITCH_SYSTEM_TEMACS, C_SWITCH_X_SYSTEM)
+	(LIB_MOTIF): Remove, configure takes care of this.
+	(NOT_USING_MOTIF): Remove, unused.
+	* xrdb.c: Remove #if 0-ed #include.
+	(SYSV): Remove conditional for old SysV.
+	* sysdep.c (closedir): Remove conditional code for Solaris,
+	Solaris has closedir.
+
+2010-04-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsettings.c (read_and_apply_settings): Check if current_font is
+	NULL before strcmp (Bug#6001).
+
 2010-04-21  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Clean up HP-UX files.
--- a/src/Makefile.in	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/Makefile.in	Fri Apr 23 22:30:27 2010 +0000
@@ -196,12 +196,6 @@
 #define LD_SWITCH_MACHINE
 #endif
 
-/* This holds special options for linking temacs
-   that should be used for linking anything else.  */
-#ifndef LD_SWITCH_MACHINE_TEMACS
-#define LD_SWITCH_MACHINE_TEMACS
-#endif
-
 /* These macros are for switches specifically related to X Windows.  */
 #ifndef C_SWITCH_X_MACHINE
 #define C_SWITCH_X_MACHINE
@@ -219,26 +213,8 @@
 #define LD_SWITCH_X_DEFAULT
 #endif
 
-#ifndef ORDINARY_LINK
-
-#ifndef START_FILES
-#ifdef NO_REMAP
-#define START_FILES pre-crt0.o /lib/crt0.o
-#else /* ! defined (NO_REMAP) */
-#define START_FILES ecrt0.o
-#endif /* ! defined (NO_REMAP) */
-#endif /* START_FILES */
 STARTFILES = START_FILES
 
-#else /* ORDINARY_LINK */
-
-/* config.h might want to force START_FILES anyway */
-#ifdef START_FILES
-STARTFILES = START_FILES
-#endif /* START_FILES */
-
-#endif /* not ORDINARY_LINK */
-
 
 #ifdef NS_IMPL_GNUSTEP
 /* Pull in stuff from GNUstep-make. */
@@ -421,7 +397,7 @@
 /* Flags to pass to LD only for temacs.  */
 /* Do not split this line with a backslash.  That can cause trouble with
    some cpps.  */
-TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS
+TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE
 
 /* A macro which other sections of Makefile can redefine to munge the
    flags before they are passed to LD.  This is helpful if you have
--- a/src/dispextern.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/dispextern.h	Fri Apr 23 22:30:27 2010 +0000
@@ -2231,7 +2231,7 @@
      If `what' == IT_COMPOSITION, the first component of a composition
      and length in bytes of the composition.
 
-     If `what' is anything else, these tow are undefined (will
+     If `what' is anything else, these two are undefined (will
      probably hold values for the last IT_CHARACTER or IT_COMPOSITION
      traversed by the iterator.
 
--- a/src/ecrt0.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/ecrt0.c	Fri Apr 23 22:30:27 2010 +0000
@@ -61,15 +61,7 @@
 
 char **environ;
 
-#ifndef static
-/* On systems where the static storage class is usable, this function
-   should be declared as static.  Otherwise, the static keyword has
-   been defined to be something else, and code for those systems must
-   take care of this declaration appropriately.  */
 static start1 ();
-#endif
-
-#ifdef CRT0_DUMMIES
 
 /* Define symbol "start": here; some systems want that symbol.  */
 asm("	.text		");
@@ -83,7 +75,7 @@
 }
 
 static
-start1 (CRT0_DUMMIES argc, xargv)
+start1 (bogus_fp, argc, xargv)
      int argc;
      char *xargv;
 {
@@ -98,7 +90,6 @@
      and optimize it out.  */
   (void) &start1;
 }
-#endif /* CRT0_DUMMIES */
 
 /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
    (do not change this comment) */
--- a/src/gtkutil.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/gtkutil.c	Fri Apr 23 22:30:27 2010 +0000
@@ -35,6 +35,7 @@
 #include "charset.h"
 #include "coding.h"
 #include <gdk/gdkkeysyms.h>
+#include "xsettings.h"
 
 #ifdef HAVE_XFT
 #include <X11/Xft/Xft.h>
--- a/src/m/intel386.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/m/intel386.h	Fri Apr 23 22:30:27 2010 +0000
@@ -44,43 +44,6 @@
 
 /* #define NO_ARG_ARRAY */
 
-/* crt0.c, if it is used, should use the i386-bsd style of entry.
-   with no extra dummy args.  On USG and XENIX,
-   NO_REMAP says this isn't used. */
-
-#define CRT0_DUMMIES bogus_fp,
-
-#ifdef SOLARIS2
-/* Data type of load average, as read out of kmem.  */
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-/* This is totally uncalibrated. */
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-
-/* J.W.Hawtin@lut.ac.uk say Solaris 2.4 as well as Solaris 2.1 on X86
-   requires -lkvm as well.
-   And handa@etl.gov.jp says that -lkvm needs -llelf, at least on 2.5.  */
-#define LIBS_MACHINE -lkvm -lelf
-
-/* configure thinks solaris X86 has gethostname, but it does not work,
-   so undefine it.  */
-#undef HAVE_GETHOSTNAME
-
-#else /* not SOLARIS2 */
-#ifdef USG5_4 /* Older USG systems do not support the load average.  */
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE long
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-/* This is totally uncalibrated. */
-
-#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
-#define FSCALE 256.0
-#endif /* USG5_4 */
-#endif /* not SOLARIS2 */
-
 #ifdef USG
 #define TEXT_START 0
 #endif /* USG */
--- a/src/m/macppc.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/m/macppc.h	Fri Apr 23 22:30:27 2010 +0000
@@ -44,10 +44,6 @@
 
 #ifdef GNU_LINUX
 #define LINKER $(CC) -nostdlib
-/* s/gnu-linux.h defines this to `-z nocombreloc' which does not work here
-   because prefix-args is not used.  */
-#undef LD_SWITCH_SYSTEM_TEMACS
-#define LD_SWITCH_MACHINE_TEMACS -Xlinker -znocombreloc
 #ifdef _ARCH_PPC64
 #undef START_FILES
 #define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
--- a/src/m/mips.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/m/mips.h	Fri Apr 23 22:30:27 2010 +0000
@@ -50,24 +50,6 @@
 
 #define TEXT_START      0x00400000
 
-
-#if 0 /* These definitions were advantageous when not using
-	 USE_LSB_TAG.  With that, they get ignored but cause errors.  */
-
-#define DATA_SEG_BITS	0x10000000
-
-/* The standard definitions of these macros would work ok,
-   but these are faster because the constants are short.  */
-
-#define XUINT(a) (((unsigned)(a) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS))
-
-#define XSET(var, type, ptr)						\
-  ((var) =								\
-   ((int)(type) << VALBITS)						\
-   + (((unsigned) (ptr) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)))
-
 /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
    (do not change this comment) */
 
-#endif /* 0 */
-
--- a/src/s/cygwin.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/cygwin.h	Fri Apr 23 22:30:27 2010 +0000
@@ -138,7 +138,8 @@
 /* Don't list system libs on link command line */
 #define LIB_STANDARD
 #define LIB_MATH
-#define LIBS_DEBUG
+
+#define START_FILES ecrt0.o
 
 /* the end */
 
--- a/src/s/freebsd.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/freebsd.h	Fri Apr 23 22:30:27 2010 +0000
@@ -69,13 +69,6 @@
    ioctl TIOCSCTTY.  */
 #define DONT_REOPEN_PTY
 
-/* The following is needed to make `configure' find Xpm, Xaw3d and
-   image include and library files if using /usr/bin/gcc.  That
-   compiler seems to be modified to not find headers in
-   /usr/local/include or libs in /usr/local/lib by default.  */
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
-
 /* Circumvent a bug in FreeBSD.  In the following sequence of
    writes/reads on a PTY, read(2) returns bogus data:
 
--- a/src/s/hpux10-20.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/hpux10-20.h	Fri Apr 23 22:30:27 2010 +0000
@@ -153,11 +153,6 @@
    We used to use -lc -lcurses, but this may be cleaner.  */
 #define LIBS_TERMCAP -ltermcap
 
-/* However, HPUX 10 puts Xaw and Xmu in a strange place
-   (if you install them at all).  So search that place.  */
-#define C_SWITCH_X_SYSTEM  -I/usr/include/X11R6 -I/usr/include/X11R5 -I/usr/include/Motif1.2 -I/usr/contrib/X11R6/include -I/usr/contrib/X11R5/include
-#define LD_SWITCH_X_DEFAULT -L/usr/lib/X11R6 -L/usr/lib/X11R5 -L/usr/lib/Motif1.2 -L/usr/contrib/X11R5/lib
-
 /* 2000-11-21: Temporarily disable Unix 98 large file support found by
    configure.  It fails on HPUX 11, at least, because it enables
    header sections which lose when `static' is defined away, as it is
@@ -175,6 +170,8 @@
 
 #define NO_REMAP
 
+#define START_FILES pre-crt0.o /lib/crt0.o
+
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
    pure and impure space as loaded can vary, and even their
    relative order cannot be relied on.
--- a/src/s/netbsd.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/netbsd.h	Fri Apr 23 22:30:27 2010 +0000
@@ -49,20 +49,6 @@
 #define LD_SWITCH_SYSTEM_tmp `echo LD_SWITCH_X_SITE_AUX | sed -e 's/-R/-Wl,-rpath,/'`
 #define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib
 
-/* The following is needed to make `configure' find Xpm, Xaw3d and
-   image include and library files if using /usr/bin/gcc.  That
-   compiler seems to be modified to not find headers in
-   /usr/local/include or libs in /usr/local/lib by default.  */
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/pkg/include -I/usr/local/include -L/usr/pkg/lib -L/usr/local/lib
-
-/* Link temacs with -z nocombreloc so that unexec works right, whether or
-   not -z combreloc is the default.  GNU ld ignores unknown -z KEYWORD
-   switches, so this also works with older versions that don't implement
-   -z combreloc.  */
-
-#define LD_SWITCH_SYSTEM_TEMACS -Wl,-z,nocombreloc
-
 /* On post 1.3 releases of NetBSD, gcc -nostdlib also clears
    the library search parth, i.e. it won't search /usr/lib
    for libc and friends. Using -nostartfiles instead avoids
--- a/src/s/openbsd.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/openbsd.h	Fri Apr 23 22:30:27 2010 +0000
@@ -17,16 +17,11 @@
 #define TERMINFO
 #define LIBS_TERMCAP -lncurses
 
-#undef LD_SWITCH_SYSTEM_TEMACS
 #undef LD_SWITCH_SYSTEM
 
   /*  Han Boetes <han@mijncomputer.nl> says this
       is necessary,  otherwise Emacs dumps core on elf systems.  */
 #define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z
 
-/* The version of gcc on OpenBSD doesn't search /usr/local/lib by
-   default.  */
-#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
-
 /* arch-tag: 7e3f65ca-3f48-4237-933f-2b208b21e8e2
    (do not change this comment) */
--- a/src/s/sol2-6.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/sol2-6.h	Fri Apr 23 22:30:27 2010 +0000
@@ -73,35 +73,6 @@
     pty_name[sizeof (pty_name) - 1] = 0;	\
   }
 
-/* `#ifdef USE_MOTIF' won't work here, since USE_MOTIF isn't defined yet.
-   Instead, dynamically check whether USE_MOTIF expands to something.  */
-#define NOT_USING_MOTIF { set x USE_MOTIF; test "$$2" = "USE_MOTIF"; }
-
-#ifndef __GNUC__
-#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib LD_SWITCH_X_SITE_AUX \
-  `NOT_USING_MOTIF || echo ' -R/usr/dt/lib'`
-#else /* GCC */
-/* We use ./prefix-args because we don't know whether LD_SWITCH_X_SITE_AUX
-   has anything in it.  It can be empty.
-   This works ok in temacs.  */
-#define LD_SWITCH_SYSTEM_TEMACS -L/usr/ccs/lib \
- `./prefix-args -Xlinker LD_SWITCH_X_SITE_AUX` \
-  `NOT_USING_MOTIF || echo ' -R/usr/dt/lib -L/usr/dt/lib'`
-
-/* Get rid of -traditional and let const really do its thing.  */
-#undef C_SWITCH_SYSTEM
-#undef const
-#endif /* GCC */
-
-/* Gregory Neil Shapiro <gshapiro@hhmi.org> reports the Motif header files
-   are in this directory on Solaris 2.4.  */
-#define C_SWITCH_X_SYSTEM -I/usr/dt/include
-
-/* -lgen is needed for the regex and regcmp functions
-   which are used by Motif.  In the future we can try changing
-   regex.c to provide them in Emacs, but this is safer for now.  */
-#define LIB_MOTIF -lXm -lgen
-
 /* This is the only known way to avoid some crashes
    that seem to relate to screwed up malloc data
    after deleting a frame.  */
--- a/src/s/unixware.h	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/s/unixware.h	Fri Apr 23 22:30:27 2010 +0000
@@ -67,6 +67,17 @@
    (do not change this comment) */
 
 
+/* Data type of load average, as read out of kmem.  */
+
+#define LOAD_AVE_TYPE long
+
+/* Convert that into an integer that is 100 for a load average of 1.0  */
+/* This is totally uncalibrated. */
+
+#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
+#define FSCALE 256.0
+
+
 #define	PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
 
 /* arch-tag: d82e92e7-9443-4a60-a581-7f293cbae8a3
--- a/src/sysdep.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/sysdep.c	Fri Apr 23 22:30:27 2010 +0000
@@ -2709,13 +2709,6 @@
   int rtnval;
 
   rtnval = emacs_close (dirp->dd_fd);
-
-  /* Some systems (like Solaris) allocate the buffer and the DIR all
-     in one block.  Why in the world are we freeing this ourselves
-     anyway?  */
-#if ! defined (SOLARIS2)
-  xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
-#endif
   xfree ((char *) dirp);
 
   return rtnval;
--- a/src/xdisp.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/xdisp.c	Fri Apr 23 22:30:27 2010 +0000
@@ -5299,6 +5299,36 @@
       break;
     case GET_FROM_BUFFER:
       it->object = it->w->buffer;
+      if (it->bidi_p)
+	{
+	  /* Bidi-iterate until we get out of the portion of text, if
+	     any, covered by a `display' text property or an overlay
+	     with `display' property.  (We cannot just jump there,
+	     because the internal coherency of the bidi iterator state
+	     can not be preserved across such jumps.)  We also must
+	     determine the paragraph base direction if the overlay we
+	     just processed is at the beginning of a new
+	     paragraph.  */
+	  if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
+	    bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+	  /* prev_stop can be zero, so check against BEGV as well.  */
+	  while (it->bidi_it.charpos >= BEGV
+		 && it->prev_stop <= it->bidi_it.charpos
+		 && it->bidi_it.charpos < CHARPOS (it->position))
+	    bidi_get_next_char_visually (&it->bidi_it);
+	  /* Record the stop_pos we just crossed, for when we cross it
+	     back, maybe.  */
+	  if (it->bidi_it.charpos > CHARPOS (it->position))
+	    it->prev_stop = CHARPOS (it->position);
+	  /* If we ended up not where pop_it put us, resync IT's
+	     positional members with the bidi iterator. */
+	  if (it->bidi_it.charpos != CHARPOS (it->position))
+	    {
+	      SET_TEXT_POS (it->position,
+			    it->bidi_it.charpos, it->bidi_it.bytepos);
+	      it->current.pos = it->position;
+	    }
+	}
       break;
     case GET_FROM_STRING:
       it->object = it->string;
@@ -6244,6 +6274,15 @@
 	{
 	  IT_CHARPOS (*it) += it->cmp_it.nchars;
 	  IT_BYTEPOS (*it) += it->cmp_it.nbytes;
+	  if (it->bidi_p)
+	    {
+	      if (it->bidi_it.new_paragraph)
+		bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+	      /* Resync the bidi iterator with IT's new position.
+		 FIXME: this doesn't support bidirectional text.  */
+	      while (it->bidi_it.charpos < IT_CHARPOS (*it))
+		bidi_get_next_char_visually (&it->bidi_it);
+	    }
 	  if (it->cmp_it.to < it->cmp_it.nglyphs)
 	    it->cmp_it.from = it->cmp_it.to;
 	  else
@@ -6965,6 +7004,15 @@
 	{
 	  IT_CHARPOS (*it) += it->cmp_it.nchars;
 	  IT_BYTEPOS (*it) += it->cmp_it.nbytes;
+	  if (it->bidi_p)
+	    {
+	      if (it->bidi_it.new_paragraph)
+		bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
+	      /* Resync the bidi iterator with IT's new position.
+		 FIXME: this doesn't support bidirectional text.  */
+	      while (it->bidi_it.charpos < IT_CHARPOS (*it))
+		bidi_get_next_char_visually (&it->bidi_it);
+	    }
 	  return 0;
 	}
       it->position = it->current.pos;
--- a/src/xrdb.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/xrdb.c	Fri Apr 23 22:30:27 2010 +0000
@@ -34,24 +34,8 @@
 #include <stdio.h>
 #include <setjmp.h>
 
-#if 1 /* I'd really appreciate it if this code could go away...  -JimB */
-/* This avoids lossage in the `dual-universe' headers on AT&T SysV
-   X11.  Don't do it on Solaris, because it breaks compilation with
-   XFree86 4.0.3 (and probably many other X11R6 releases) on Solaris
-   2 */
-#if defined(USG5) && !defined(SOLARIS2)
-#ifndef SYSV
-#define SYSV
-#endif
-#endif /* USG5 && !SOLARIS2 */
-
-#endif /* 1 */
-
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
-#if 0
-#include <X11/Xos.h>
-#endif
 #include <X11/X.h>
 #include <X11/Xutil.h>
 #include <X11/Xresource.h>
--- a/src/xsettings.c	Thu Apr 22 12:19:18 2010 +0000
+++ b/src/xsettings.c	Fri Apr 23 22:30:27 2010 +0000
@@ -578,7 +578,7 @@
 
   if (settings.seen & SEEN_FONT)
     {
-      if (strcmp (current_font, settings.font) != 0) 
+      if (!current_font || strcmp (current_font, settings.font) != 0) 
         {
           free (current_font);
           current_font = settings.font;