changeset 108413:7a13dbee674f

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 10 Feb 2010 14:06:11 +0000
parents fd9a89143e0a (current diff) 12a12a93b1a3 (diff)
children 1f72eef0d33f
files
diffstat 17 files changed, 188 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/doc/emacs/ChangeLog	Sun Feb 07 02:40:11 2010 +0000
+++ b/doc/emacs/ChangeLog	Wed Feb 10 14:06:11 2010 +0000
@@ -1,3 +1,7 @@
+2010-02-08  Glenn Morris  <rgm@gnu.org>
+
+	* buffers.texi (Uniquify): Must explicitly load library.  (Bug#5529)
+
 2010-02-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* display.texi (Useless Whitespace, Text Display):
--- a/doc/emacs/buffers.texi	Sun Feb 07 02:40:11 2010 +0000
+++ b/doc/emacs/buffers.texi	Wed Feb 10 14:06:11 2010 +0000
@@ -583,7 +583,8 @@
 
 @vindex uniquify-buffer-name-style
   Other methods work by adding parts of each file's directory to the
-buffer name.  To select one, customize the variable
+buffer name.  To select one, load the library @file{uniquify} (e.g.
+using @code{(require 'uniquify)}), and customize the variable
 @code{uniquify-buffer-name-style} (@pxref{Easy Customization}).
 
   To begin with, the @code{forward} naming method includes part of the
--- a/lisp/ChangeLog	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/ChangeLog	Wed Feb 10 14:06:11 2010 +0000
@@ -1,3 +1,54 @@
+2010-02-10  Chong Yidong  <cyd@stupidchicken.com>
+
+	* iswitchb.el (iswitchb-completions): Revert last change.
+
+2010-02-10  Michael Albinus  <michael.albinus@gmx.de>
+
+	* ls-lisp.el (ls-lisp-insert-directory): Wen WILDCARD-REGEXP and
+	FULL-DIRECTORY-P are nil, and FILE is absolute, expand it.  This
+	prevents file names like "~/" been listed literally.
+
+2010-02-10  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* term/xterm.el (xterm-maybe-set-dark-background-mode): Remove
+	dead code.  (Bug#5546)
+
+2010-02-09  Chong Yidong  <cyd@stupidchicken.com>
+
+	* eshell/em-ls.el (eshell-ls-applicable): Frob file attributes
+	correctly (Bug#5548).
+
+2010-02-08  Jose E. Marchesi  <jemarch@gnu.org>
+
+	* progmodes/ada-mode.el (ada-in-numeric-literal-p): New function.
+	(ada-adjust-case): Don't adjust case in hexadecimal number
+	literals.
+
+2010-02-08  Kenichi Handa  <handa@m17n.org>
+
+	* international/mule-util.el (with-coding-priority): Add autoload
+	cookie for putting `lisp-indent-funciton'.
+
+2010-02-07  Glenn Morris  <rgm@gnu.org>
+
+	* progmodes/f90.el (f90-font-lock-keywords-1, f90-font-lock-keywords-2):
+	Move F2003 named interfaces from keywords-2 to keywords-1, and
+	use function-name-face rather than constant-face.
+	Simplify "abstract interface" regexp.
+
+2010-02-07  Chong Yidong  <cyd@stupidchicken.com>
+
+	* eshell/esh-util.el (eshell-file-attributes): New optional arg
+	ID-FORMAT.  Pass it to `file-attributes'.
+
+	* eshell/em-ls.el (eshell-do-ls): Use it (Bug#5528).
+
+2010-02-07  sj  <prime.wizard+emacs@gmail.com>  (tiny change)
+
+	* faces.el (set-face-attribute): Allow calling
+	internal-set-lisp-face-attribute with 'unspecified family and
+	foundry argument (Bug#5536).
+
 2010-02-07  Glenn Morris  <rgm@gnu.org>
 
 	* progmodes/f90.el (f90-font-lock-keywords-2)
--- a/lisp/erc/ChangeLog	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/erc/ChangeLog	Wed Feb 10 14:06:11 2010 +0000
@@ -1,3 +1,7 @@
+2010-02-07  Vivek Dasmohapatra  <vivek@etla.org>
+
+	* erc-services.el (erc-nickserv-alist): Fix defcustom type (Bug#5520).
+
 2010-01-25  Vivek Dasmohapatra  <vivek@etla.org>
 
 	* erc-backend.el (erc-session-connector): New var.
--- a/lisp/erc/erc-services.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/erc/erc-services.el	Wed Feb 10 14:06:11 2010 +0000
@@ -303,7 +303,11 @@
 		 (boolean :tag "Use current nick in identify message?")
 		 (choice :tag "Command to use (optional)"
 		  (string :tag "Command")
-		  (const :tag "No special command necessary" nil)))))
+		  (const :tag "No special command necessary" nil))
+		 (choice :tag "Detect Success"
+			 (regexp :tag "Pattern to match")
+			 (const :tag "Do not try to detect success" nil)))))
+
 
 (defsubst erc-nickserv-alist-sender (network &optional entry)
   (nth 1 (or entry (assoc network erc-nickserv-alist))))
--- a/lisp/eshell/em-ls.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/eshell/em-ls.el	Wed Feb 10 14:06:11 2010 +0000
@@ -225,18 +225,28 @@
       (eq (aref (nth 8 attrs) 0) type)))
 
 (defmacro eshell-ls-applicable (attrs index func file)
-  "Test whether, for ATTRS, the user UID can do what corresponds to INDEX.
-This is really just for efficiency, to avoid having to stat the file
-yet again."
-  `(if (numberp (nth 2 ,attrs))
-       (if (= (user-uid) (nth 2 ,attrs))
-	   (not (eq (aref (nth 8 ,attrs) ,index) ?-))
-	 (,(eval func) ,file))
-     (not (eq (aref (nth 8 ,attrs)
-		    (+ ,index (if (member (nth 2 ,attrs)
-					  (eshell-current-ange-uids))
-				  0 6)))
-	      ?-))))
+  "Test whether, for ATTRS, the user can do what corresponds to INDEX.
+ATTRS is a string of file modes.  See `file-attributes'.
+If we cannot determine the answer using ATTRS (e.g., if we need
+to know what group the user is in), compute the return value by
+calling FUNC with FILE as an argument."
+  `(let ((owner (nth 2 ,attrs))
+	 (modes (nth 8 ,attrs)))
+     (cond ((cond ((numberp owner)
+		   (= owner (user-uid)))
+		  ((stringp owner)
+		   (or (string-equal owner (user-login-name))
+		       (member owner (eshell-current-ange-uids)))))
+	    ;; The user owns this file.
+	    (not (eq (aref modes ,index) ?-)))
+	   ((eq (aref modes (+ ,index 3))
+		(aref modes (+ ,index 6)))
+	    ;; If the "group" and "other" fields give identical
+	    ;; results, use that.
+	    (not (eq (aref modes (+ ,index 3)) ?-)))
+	   (t
+	    ;; Otherwise call FUNC.
+	    (,(eval func) ,file)))))
 
 (defcustom eshell-ls-highlight-alist nil
   "*This alist correlates test functions to color.
@@ -393,13 +403,13 @@
 	       (eshell-glob-regexp ignore-pattern))))
      ;; list the files!
      (eshell-ls-entries
-      (mapcar (function
-	       (lambda (arg)
-		 (cons (if (and (eshell-under-windows-p)
-				(file-name-absolute-p arg))
-			   (expand-file-name arg)
-			 arg)
-		       (eshell-file-attributes arg))))
+      (mapcar (lambda (arg)
+		(cons (if (and (eshell-under-windows-p)
+			       (file-name-absolute-p arg))
+			  (expand-file-name arg)
+			arg)
+		      (eshell-file-attributes
+		       arg (if numeric-uid-gid 'integer 'string))))
 	      args)
       t (expand-file-name default-directory)))
    (funcall flush-func)))
@@ -710,7 +720,7 @@
 	    (funcall insert-func need-return "\n"))))))
 
 (defun eshell-ls-entries (entries &optional separate root-dir)
-  "Output PATH's directory ENTRIES, formatted according to OPTIONS.
+  "Output PATH's directory ENTRIES.
 Each member of ENTRIES may either be a string or a cons cell, the car
 of which is the file name, and the cdr of which is the list of
 attributes.
--- a/lisp/eshell/esh-util.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/eshell/esh-util.el	Wed Feb 10 14:06:11 2010 +0000
@@ -701,8 +701,11 @@
 	(forward-line)))
     entry))
 
-(defun eshell-file-attributes (file)
-  "Return the attributes of FILE, playing tricks if it's over ange-ftp."
+(defun eshell-file-attributes (file &optional id-format)
+  "Return the attributes of FILE, playing tricks if it's over ange-ftp.
+The optional argument ID-FORMAT specifies the preferred uid and
+gid format.  Valid values are 'string and 'integer, defaulting to
+'integer.  See `file-attributes'."
   (let* ((file (expand-file-name file))
 	 entry)
     (if (string-equal (file-remote-p file 'method) "ftp")
@@ -723,7 +726,7 @@
 		      (setq entry (cdr fentry))
 		    (setq entry nil)))))
 	  entry)
-      (file-attributes file))))
+      (file-attributes file id-format))))
 
 (defalias 'eshell-copy-tree 'copy-tree)
 
--- a/lisp/faces.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/faces.el	Wed Feb 10 14:06:11 2010 +0000
@@ -735,10 +735,10 @@
 	(unless foundry
 	  (setq foundry (match-string 1 family)))
 	(setq family (match-string 2 family)))
-      (when (stringp family)
+      (when (or (stringp family) (eq family 'unspecified))
 	(internal-set-lisp-face-attribute face :family (purecopy family)
 					  where))
-      (when (stringp foundry)
+      (when (or (stringp foundry) (eq foundry 'unspecified))
 	(internal-set-lisp-face-attribute face :foundry (purecopy foundry)
 					  where)))
     (while args
--- a/lisp/international/mule-util.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/international/mule-util.el	Wed Feb 10 14:06:11 2010 +0000
@@ -323,7 +323,7 @@
      (unwind-protect
 	 (progn ,@body)
        (apply #'set-coding-system-priority ,current)))))
-(put 'with-coding-priority 'lisp-indent-function 1)
+;;;###autoload(put 'with-coding-priority 'lisp-indent-function 1)
 (put 'with-coding-priority 'edebug-form-spec t)
 
 ;;;###autoload
--- a/lisp/iswitchb.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/iswitchb.el	Wed Feb 10 14:06:11 2010 +0000
@@ -1274,7 +1274,7 @@
     ;; consult the list of past visited files, to see if we can find
     ;; the file which the user might thought was still open.
     (when (and iswitchb-use-virtual-buffers (null comps)
-	       (or recentf-list bookmark-alist))
+	       recentf-list)
       (setq iswitchb-virtual-buffers nil)
       (let ((head recentf-list) name)
 	(while head
@@ -1289,30 +1289,15 @@
 	      (setq iswitchb-virtual-buffers
 		    (cons (cons name (car head))
 			  iswitchb-virtual-buffers)))
-	  (setq head (cdr head))))
-      (let ((head bookmark-alist) name path)
-	(while head
-	  (if (and (setq path (cdr (assq 'filename (cdar head))))
-		   (setq name (file-name-nondirectory path))
-		   (string-match (if iswitchb-regexp
-				     iswitchb-text
-				   (regexp-quote iswitchb-text)) name)
-		   (null (get-file-buffer path))
-		   (not (assoc name iswitchb-virtual-buffers))
-		   (not (iswitchb-ignore-buffername-p name))
-		   (file-exists-p path))
-	      (setq iswitchb-virtual-buffers
-		    (cons (cons name path)
-			  iswitchb-virtual-buffers)))
-	  (setq head (cdr head))))
-      (setq iswitchb-virtual-buffers (nreverse iswitchb-virtual-buffers)
-	    comps (mapcar 'car iswitchb-virtual-buffers))
+	  (setq head (cdr head)))
+	(setq iswitchb-virtual-buffers (nreverse iswitchb-virtual-buffers)
+	      comps (mapcar 'car iswitchb-virtual-buffers))
 	(let ((comp comps))
 	  (while comp
 	    (put-text-property 0 (length (car comp))
 			       'face 'iswitchb-virtual-matches
 			       (car comp))
-	    (setq comp (cdr comp)))))
+	    (setq comp (cdr comp))))))
 
     (cond ((null comps) (format " %sNo match%s"
 				open-bracket-determined
--- a/lisp/ls-lisp.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/ls-lisp.el	Wed Feb 10 14:06:11 2010 +0000
@@ -400,6 +400,7 @@
     ;; If not full-directory-p, FILE *must not* end in /, as
     ;; file-attributes will not recognize a symlink to a directory,
     ;; so must make it a relative filename as ls does:
+    (if (file-name-absolute-p file) (setq file (expand-file-name file)))
     (if (eq (aref file (1- (length file))) ?/)
 	(setq file (substring file 0 -1)))
     (let ((fattr (file-attributes file 'string)))
--- a/lisp/progmodes/ada-mode.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/progmodes/ada-mode.el	Wed Feb 10 14:06:11 2010 +0000
@@ -1017,6 +1017,9 @@
 			  (line-beginning-position) (point))))
   (or (ada-in-string-p parse-result) (ada-in-comment-p parse-result)))
 
+(defsubst ada-in-numeric-literal-p ()
+  "Return t if point is after a prefix of a numeric literal."
+  (looking-back "\\([0-9]+#[0-9a-fA-F_]+\\)"))
 
 ;;------------------------------------------------------------------
 ;; Contextual menus
@@ -1606,6 +1609,8 @@
 		 (eq (char-syntax (char-before)) ?w)
 		 ;;  if in a string or a comment
 		 (not (ada-in-string-or-comment-p))
+		 ;;  if in a numeric literal
+		 (not (ada-in-numeric-literal-p))
 		 )
 	    (if (save-excursion
 		  (forward-word -1)
--- a/lisp/progmodes/f90.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/progmodes/f90.el	Wed Feb 10 14:06:11 2010 +0000
@@ -158,10 +158,8 @@
 ;; 3. Support for align.
 ;; Font-locking:
 ;; 1. OpenMP, OpenMPI?, preprocessor highlighting.
-;; 2. interface blah - Highlight "blah" in function-name face?
-;; Need to avoid "interface operator (+)" etc.
-;; 3. integer_name = 1
-;; 4. Labels for "else" statements (F2003)?
+;; 2. integer_name = 1
+;; 3. Labels for "else" statements (F2003)?
 
 (defvar comment-auto-fill-only-comments)
 (defvar font-lock-keywords)
@@ -467,22 +465,21 @@
 ;;;      (1 font-lock-keyword-face) (3 font-lock-function-name-face))
    '(f90-typedef-matcher
      (1 font-lock-keyword-face) (2 font-lock-function-name-face))
-   ;; Other functions and declarations.
+    ;; F2003.  Prevent operators being highlighted as functions.
+    '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
+read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
+   ;; Other functions and declarations.  Named interfaces = F2003.
    '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|module\\|function\\|associate\\|\
-subroutine\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?"
+subroutine\\|interface\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?"
      (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
    ;; F2003.
    '("\\<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\
 \\(\\sw+\\)"
      (1 font-lock-keyword-face) (2 font-lock-keyword-face)
      (3 font-lock-function-name-face))
-   "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\|\
-end[ \t]*interface\\)\\>"
-   ;; "abstract interface" is F2003. Must come after previous entry.
-   '("\\<\\(\\(?:abstract[ \t]*\\)?interface\\)\\>"
-     ;; [ \t]*\\(\\(\\sw+\\)[ \t]*[^(]\\)?"
-     ;; (2) messes up "interface operator ()", etc.
-     (1 font-lock-keyword-face))) ;(2 font-lock-function-name-face nil t)))
+   "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\>"
+   ;; "abstract interface" is F2003.
+   '("\\<abstract[ \t]*interface\\>" (0 font-lock-keyword-face t)))
   "This does fairly subdued highlighting of comments and function calls.")
 
 ;; NB not explicitly handling this, yet it seems to work.
@@ -560,12 +557,6 @@
       (5 font-lock-function-name-face t) (6 'default t))
     ;; enum (F2003; must be followed by ", bind(C)").
     '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face))
-    ;; F2003.  Prevent operators being highlighted as constants.
-    '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
-read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
-    ;; Interface blocks can be named in F2003.
-    '("\\<\\(\\(?:end[ \t]*\\)?interface\\)[ \t]*\\(\\sw+\\)?\\>"
-      (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
     ;; end do, enum (F2003), if, select, where, and forall constructs.
     '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\)\\)\\>\
 \\([ \t]+\\(\\sw+\\)\\)?"
--- a/lisp/term/xterm.el	Sun Feb 07 02:40:11 2010 +0000
+++ b/lisp/term/xterm.el	Wed Feb 10 14:06:11 2010 +0000
@@ -679,7 +679,6 @@
   ;; Use the heuristic in `frame-set-background-mode' to decide if a
   ;; frame is dark.
   (when (< (+ redc greenc bluec) (* .6 (+ 65535 65535 65535)))
-    (setq xterm-background-mode-changed t)
     (set-terminal-parameter nil 'background-mode 'dark)
     t))
 
--- a/src/ChangeLog	Sun Feb 07 02:40:11 2010 +0000
+++ b/src/ChangeLog	Wed Feb 10 14:06:11 2010 +0000
@@ -1,3 +1,20 @@
+2010-02-10  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsmfns.c (x_session_initialize): Move initialization of ice_fd and
+	doing_interact here.
+	(ice_connection_closed): New function.
+	(x_session_check_input, smc_die_CB, ice_io_error_handler)
+	(ice_conn_watch_CB, x_session_close): Call ice_connection_closed.
+	(x_session_check_input): Call IceCloseConnection if IceProcessMessages
+	returns I/O error.
+	(ice_conn_watch_CB): Call add_keyboard_wait_descriptor on ice_fd,
+	bug #5512.
+
+2010-02-08  Francis Devereux  <francis@devrx.org>  (tiny change)
+
+	* nsfont.m (nsfont_open): The system's value for the font descent
+	is negative, so round it down to avoid clipping.
+
 2010-02-06  Chong Yidong  <cyd@stupidchicken.com>
 
 	* charset.c (load_charset_map_from_file)
--- a/src/nsfont.m	Sun Feb 07 02:40:11 2010 +0000
+++ b/src/nsfont.m	Wed Feb 10 14:06:11 2010 +0000
@@ -844,8 +844,10 @@
     /* max bounds */
     font_info->max_bounds.ascent =
       lrint (hshrink * [sfont ascender] + expand * hd/2);
+    /* [sfont descender] is usually negative.  Use floor to avoid
+       clipping descenders. */
     font_info->max_bounds.descent =
-      -lrint (hshrink* [sfont descender] - expand*hd/2);
+      -lrint (floor(hshrink* [sfont descender] - expand*hd/2));
     font_info->height =
       font_info->max_bounds.ascent + font_info->max_bounds.descent;
     font_info->max_bounds.width = lrint (font_info->width);
@@ -880,8 +882,8 @@
 #endif
 
     /* set up metrics portion of font struct */
-    font->ascent = [sfont ascender];
-    font->descent = -[sfont descender];
+    font->ascent = lrint([sfont ascender]);
+    font->descent = -lrint(floor([sfont descender]));
     font->min_width = ns_char_width(sfont, '|');
     font->space_width = lrint (ns_char_width (sfont, ' '));
     font->average_width = lrint (font_info->width);
--- a/src/xsmfns.c	Sun Feb 07 02:40:11 2010 +0000
+++ b/src/xsmfns.c	Wed Feb 10 14:06:11 2010 +0000
@@ -52,11 +52,11 @@
 
 /* The descriptor that we use to check for data from the session manager.  */
 
-static int ice_fd = -1;
+static int ice_fd;
 
 /* A flag that says if we are in shutdown interactions or not.  */
 
-static int doing_interact = False;
+static int doing_interact;
 
 /* The session manager object for the session manager connection.  */
 
@@ -90,6 +90,14 @@
 
 #define NOSPLASH_OPT "--no-splash"
 
+static void
+ice_connection_closed ()
+{
+  if (ice_fd >= 0)
+    delete_keyboard_wait_descriptor (ice_fd);
+  ice_fd = -1;
+}
+
 
 /* Handle any messages from the session manager.  If no connection is
    open to a session manager, just return 0.
@@ -101,9 +109,9 @@
 {
   SELECT_TYPE read_fds;
   EMACS_TIME tmout;
+  int ret;
 
   if (ice_fd == -1) return 0;
-
   FD_ZERO (&read_fds);
   FD_SET (ice_fd, &read_fds);
 
@@ -116,26 +124,33 @@
      will be called.  */
   emacs_event.kind = NO_EVENT;
 
-  if (select (ice_fd+1, &read_fds,
-              (SELECT_TYPE *)0, (SELECT_TYPE *)0, &tmout) < 0)
+  ret = select (ice_fd+1, &read_fds,
+                (SELECT_TYPE *)0, (SELECT_TYPE *)0, &tmout);
+
+  if (ret < 0)
     {
-      ice_fd = -1;
-      return 0;
+      ice_connection_closed ();
     }
-
+  else if (ret > 0 && FD_ISSET (ice_fd, &read_fds))
+    {
+      ret = IceProcessMessages (SmcGetIceConnection (smc_conn),
+                                (IceReplyWaitInfo *)0, (Bool *)0);
+      if (ret != IceProcessMessagesSuccess)
+        {
+          /* Either IO error or Connection closed.  */
+          if (ret == IceProcessMessagesIOError)
+            IceCloseConnection (SmcGetIceConnection (smc_conn));
 
-  if (FD_ISSET (ice_fd, &read_fds))
-    IceProcessMessages (SmcGetIceConnection (smc_conn),
-                        (IceReplyWaitInfo *)0, (Bool *)0);
-
+          ice_connection_closed ();
+        }
+    }
 
   /* Check if smc_interact_CB was called and we shall generate a
      SAVE_SESSION_EVENT.  */
-  if (emacs_event.kind == NO_EVENT)
-    return 0;
+  if (emacs_event.kind != NO_EVENT)
+    bcopy (&emacs_event, bufp, sizeof (struct input_event));
 
-  bcopy (&emacs_event, bufp, sizeof (struct input_event));
-  return 1;
+  return emacs_event.kind != NO_EVENT ? 1 : 0;
 }
 
 /* Return non-zero if we have a connection to a session manager.  */
@@ -284,7 +299,7 @@
      SmPointer clientData;
 {
   SmcCloseConnection (smcConn, 0, 0);
-  ice_fd = -1;
+  ice_connection_closed ();
 }
 
 /* We don't use the next two but they are mandatory, leave them empty.
@@ -356,7 +371,7 @@
      IceConn iceConn;
 {
   /* Connection probably gone.  */
-  ice_fd = -1;
+  ice_connection_closed ();
 }
 
 /* This is called when the ICE connection is created or closed.  The SM library
@@ -371,7 +386,7 @@
 {
   if (! opening)
     {
-      ice_fd = -1;
+      ice_connection_closed ();
       return;
     }
 
@@ -384,6 +399,8 @@
   if (interrupt_input)
     init_sigio (ice_fd);
 #endif /* ! defined (SIGIO) */
+
+  add_keyboard_wait_descriptor (ice_fd);
 }
 
 /* Create the client leader window.  */
@@ -426,6 +443,9 @@
   SmcCallbacks callbacks;
   int  name_len = 0;
 
+  ice_fd = -1;
+  doing_interact = False;
+
   /* Check if we where started by the session manager.  If so, we will
      have a previous id.  */
   if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
@@ -497,7 +517,7 @@
 void
 x_session_close ()
 {
-  ice_fd = -1;
+  ice_connection_closed ();
 }