changeset 108089:2bdfb77de643

Fix display of composed characters from L2R scripts in bidi buffers. (Bug#5977) xdisp.c (set_iterator_to_next, next_element_from_composition): After advancing IT past the composition, resync the bidi iterator with IT's position.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 23 Apr 2010 21:23:51 +0300
parents 076e73b014a5 (diff) d9c182b86800 (current diff)
children b8f821937636
files src/ChangeLog src/xdisp.c
diffstat 19 files changed, 215 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Fri Apr 23 21:10:31 2010 +0300
+++ b/etc/NEWS	Fri Apr 23 21:23:51 2010 +0300
@@ -86,6 +86,9 @@
 *** 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)
--- a/lisp/ChangeLog	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/ChangeLog	Fri Apr 23 21:23:51 2010 +0300
@@ -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.
--- a/lisp/emacs-lisp/bytecomp.el	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/gnus/ChangeLog	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/gnus/mm-util.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/gnus/yenc.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/ange-ftp.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/tramp-fish.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/tramp-gvfs.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/tramp-imap.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/tramp-smb.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/net/tramp.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/progmodes/compile.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/lisp/tool-bar.el	Fri Apr 23 21:23:51 2010 +0300
@@ -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	Fri Apr 23 21:10:31 2010 +0300
+++ b/src/ChangeLog	Fri Apr 23 21:23:51 2010 +0300
@@ -1,14 +1,32 @@
 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)
-	(set_iterator_to_next, next_element_from_composition): Fix display
-	of composed characters from L2R scripts in bidi buffers.
-	(Bug#5977)
 
 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.
 
--- a/src/Makefile.in	Fri Apr 23 21:10:31 2010 +0300
+++ b/src/Makefile.in	Fri Apr 23 21:23:51 2010 +0300
@@ -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
@@ -403,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	Fri Apr 23 21:10:31 2010 +0300
+++ b/src/dispextern.h	Fri Apr 23 21:23:51 2010 +0300
@@ -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/gtkutil.c	Fri Apr 23 21:10:31 2010 +0300
+++ b/src/gtkutil.c	Fri Apr 23 21:23:51 2010 +0300
@@ -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/macppc.h	Fri Apr 23 21:10:31 2010 +0300
+++ b/src/m/macppc.h	Fri Apr 23 21:23:51 2010 +0300
@@ -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