--- elscreen-1.4.6-orig/elscreen.el	2013-05-23 21:31:14.011823000 +1000
+++ elscreen-1.4.6/elscreen.el	2013-10-03 20:55:35.497650931 +1000
@@ -29,9 +29,9 @@
 (eval-when-compile
   (require 'static))
 
-(static-defconst elscreen-on-xemacs (featurep 'xemacs))
-(static-defconst elscreen-on-emacs (and (not elscreen-on-xemacs)
-                                        (>= emacs-major-version 21)))
+(static-defconst elscreen-on-xemacs (featurep 'xemacs)
+  (static-defconst elscreen-on-emacs (and (not elscreen-on-xemacs)
+                                          (>= emacs-major-version 21))))
 
 
 ;;; User Customizable Variables:
@@ -148,7 +148,8 @@
 
 (static-when elscreen-on-emacs ;; GNU Emacs 21
   (make-obsolete-variable 'elscreen-tab-display-create-screen
-                          'elscreen-tab-display-control)
+                          'elscreen-tab-display-control
+			  "1.4.6")
   (defcustom elscreen-tab-display-control t
     "*Non-nil to display control tab at the most left side."
     :tag "Show/Hide the Control Tab"
@@ -201,13 +202,13 @@
       (((class color))
        (:background "blue" :foreground "black" :underline t)))
     "Face for tabs other than current screen one."
-    :group 'elscreen))
+    :group 'elscreen)
 
 
 ;;; Key & Menu bindings:
 
-(defvar elscreen-map (make-sparse-keymap)
-  "Keymap for ElScreen.")
+  (defvar elscreen-map (make-sparse-keymap)
+    "Keymap for ElScreen."))
 (define-key elscreen-map "\C-c" 'elscreen-create)
 (define-key elscreen-map "c"    'elscreen-create)
 (define-key elscreen-map "C"    'elscreen-clone)
@@ -899,13 +900,13 @@
          screen-list-string)
     (cond
      ((not (elscreen-screen-live-p screen)) ;; XXX
-      (when (interactive-p)
+      (when (called-interactively-p 'any)
         (elscreen-message "There is no such screen")))
      ((null screen-list)
-      (when (interactive-p)
+      (when (called-interactively-p 'any)
         (elscreen-message "There is only one screen, cannot kill")))
      ((or
-       (not (interactive-p))
+       (not (called-interactively-p 'any))
        (yes-or-no-p (format "Really kill screens other than %d? " screen)))
       (setq screen-list-string (mapconcat
                                 (lambda (screen)
@@ -914,7 +915,7 @@
                                 screen-list ","))
       (elscreen-goto-internal screen)
       (elscreen-notify-screen-modification 'force-immediately)
-      (when (interactive-p)
+      (when (called-interactively-p 'any)
         (elscreen-message (format "screen %s killed" screen-list-string)))))
     screen-list))
 
@@ -984,7 +985,7 @@
 (defun elscreen-jump ()
   "Switch to specified screen."
   (interactive)
-  (let ((next-screen (string-to-number (string last-command-char))))
+  (let ((next-screen (string-to-number (string last-command-event))))
     (if (and (<= 0 next-screen) (<= next-screen 9))
         (elscreen-goto next-screen))))
 (defalias 'elscreen-jump-0 'elscreen-jump)
@@ -1046,7 +1047,7 @@
     (princ (substitute-command-keys
             (mapconcat 'symbol-value
                        elscreen-help-symbol-list "\n\n")))
-    (print-help-return-message)))
+    (help-print-return-message)))
 
 
 ;;; Utility Functions
@@ -1180,7 +1181,7 @@
 creating one if none already exists."
   (interactive)
   (let* ((prompt "Go to the screen with specified buffer: ")
-         (create (or create (interactive-p)))
+         (create (or create (called-interactively-p 'any)))
          (buffer-name (or (and (bufferp buffer) (buffer-name buffer))
                           (and (stringp buffer) buffer)
                           (and (featurep 'iswitchb)
@@ -1207,7 +1208,7 @@
 Use \\[toggle-read-only] to permit editing."
   (interactive "FFind file read-only in new screen: ")
   (elscreen-find-file filename)
-  (toggle-read-only 1))
+  (read-only-mode 1))
 
 (defun elscreen-dired (dirname &optional switches)
   (interactive (progn
@@ -1373,27 +1374,28 @@
   (defvar elscreen-e21-tab-format nil)
   (make-variable-buffer-local 'elscreen-e21-tab-format)
 
-  (defsubst elscreen-e21-tab-create-keymap (&rest definitions)
-    (let ((keymap (make-sparse-keymap))
-          (key-function-pairs
-           (eval-when-compile
-             (mapcar
-              (lambda (key)
-                (cons key 'ignore))
-              (list 'mouse-1 'mouse-2 'mouse-3
-                    'down-mouse-1 'down-mouse-2 'down-mouse-3
-                    'drag-mouse-1 'drag-mouse-2 'drag-mouse-3)))))
-      (while definitions
-        (set-alist 'key-function-pairs (car definitions) (cadr definitions))
-        (setq definitions (cddr definitions)))
-      (mapc
-       (lambda (key-function-pair)
-         (let ((key (car key-function-pair))
-               (function (cdr key-function-pair)))
-           (define-key keymap (vector 'header-line key) function)))
-       key-function-pairs)
-      keymap))
-
+  (eval-when-compile
+    (defsubst elscreen-e21-tab-create-keymap (&rest definitions)
+      (let ((keymap (make-sparse-keymap))
+            (key-function-pairs
+             (eval-when-compile
+               (mapcar
+                (lambda (key)
+                  (cons key 'ignore))
+                (list 'mouse-1 'mouse-2 'mouse-3
+                      'down-mouse-1 'down-mouse-2 'down-mouse-3
+                      'drag-mouse-1 'drag-mouse-2 'drag-mouse-3)))))
+        (while definitions
+          (set-alist 'key-function-pairs (car definitions) (cadr definitions))
+          (setq definitions (cddr definitions)))
+        (mapc
+         (lambda (key-function-pair)
+           (let ((key (car key-function-pair))
+                 (function (cdr key-function-pair)))
+             (define-key keymap (vector 'header-line key) function)))
+         key-function-pairs)
+        keymap)))
+        
   (defsubst elscreen-e21-tab-width ()
     (if (numberp elscreen-display-tab)
         elscreen-display-tab
