
(provide (quote epoch))

(require (quote epoch-util))

(defvar auto-raise-screen (quote minibuf) "\
If set t, focus events will raise screen and minibuffer.  If set to
'screen, only edit screen will raise.  If set to 'minibuf, only
minibuffer screen will raise.  If set to nil, no screens will be
raised.")

(defvar include-system-name t "\
Sets the system name to be included in the screen title")

(defvar epoch-mode-alist nil)

(defvar restarts nil)

(defun sys-name nil (byte-code "ƒ ÁÂ P‚ Ã‡" [include-system-name " @ " system-name ""] 3))

(defun epoch::do-titles nil (byte-code "ÂÃÄ !!ÅÆ!Ç PÄ \"ˆÈÅÁÄ \"Ä \")ˆÉ …8 ÅÅÁÉ \"Ç PÉ \"ˆÈÅÁÉ \"É \"‡" [buf nil window-buffer epoch::selected-window current-screen epoch::title buffer-name sys-name epoch::icon-name epoch::minibuf-screen] 23))

(epoch-add-setup-hook (quote epoch::init))

(defun epoch::init nil (byte-code "Á‰ˆÅÆÇÁ!\"ˆÃÃ)ˆÈB‰‡" [epoch::global-update t s nil epoch::screen-properties mapcar (lambda (s) (byte-code "ÂÀ	\"‡" [t s epoch::set-update] 3)) epoch::screen-list (update t)] 4))

(setq restarts t)

(defvar *create-screen-alist-hook* nil "\
A hook that is called with the
create-screen alist just before the screen is actually created. Should
return a new alist (or the old one if no change).")

(defun create-screen (&optional buff alist) "\
Create a new edit screen. Optional BUFFER indicates the buffer to put in
root window of the screen. Optional ALIST is a list of attributes for the
new screen. ALIST is augmented by searching epoch-mode-alist for mode
dependent attributes." (interactive) (byte-code "Èˆ	…	 Í	!ƒ Î!Ï P‚ ÐÑÒ	!Ó
BÔ
BD#È<ƒ= ÕÖ\"ˆÈÈ)‚K ×!…K Ø\"‰ˆÙ	\"‰ˆ	…i Í	!…i Š	qˆ	B‰	)ˆÚ
#ˆÛÜ\"?† A)…‘ ÛÝ\"A?…‘ Þ!ˆ,‡" [b buff xname real-alist alist scr *create-screen-alist-hook* hook nil allowed-screens xa-wm-protocols wm-protocol-list is get-buffer buffer-name sys-name "Edit" append get-epoch-mode-alist-contents title icon-name mapcar (lambda (hook) (byte-code "Â	\"‰‡" [real-alist hook funcall] 3)) functionp funcall epoch::create-screen epoch::set-property assq initial-state no-map epoch::mapraised-screen] 15))

(defun remove-screen-from-buffer (buf) "\
Delete screen from BUFFER's allowed-screen list" (byte-code "ŠqˆÃ
	\"‰)‡" [buf allowed-screens the-scr delq] 3))

(defun delete-screen (&optional scr) "\
Delete SCREEN and remove it from allowed-screens list for all buffers" (interactive) (byte-code "Âˆ	† Ã ÄÅKÆ \")ˆÇ	!‡" [the-scr scr nil current-screen mapcar remove-screen-from-buffer buffer-list epoch::delete-screen] 5))

(defvar *select-screen-hook* nil "\
A hook that is called whenever a screen is selected via select-screen.")

(defun select-screen (&optional scr) "\
Select SCREEN (or current screen) and raise it." (interactive) (byte-code "ÃˆÄ!ˆÅ	=ƒ Æ ‚3 Ç	=ƒ\" È … ÆÉ!‚3 Â	=…3 È …0 ÆÉ!ˆÆ ˆÊË!‡" [scr auto-raise-screen t nil epoch::select-screen screen epoch::raise-screen minibuf epoch::minibuf-screen 0 run-hooks *select-screen-hook*] 9))

(defun unmap-screen (&optional scr) "\
Unmap the screen" (interactive) (byte-code "ÁˆÂ!ˆ?† Ã =… Ä ˆ‡" [scr nil epoch::unmap-screen epoch::current-screen epoch::select-screen] 4))

(defun iconify-screen (&optional scr) "\
Iconify SCREEN (or current screen)" (interactive) (byte-code "ÁˆÂ!ˆ?† Ã =… Ä ˆ‡" [scr nil epoch::iconify-screen epoch::current-screen epoch::select-screen] 4))

(defvar epoch::cursor-warps-to-screen t "\
*T if cursor-to-screen warps cursor to screen; NIL otherwise.")

(defun cursor-to-screen (scr) "\
Warp cursor to SCREEN and select it" (interactive) (byte-code "Ãˆ…	 Ä	!ˆ
… ÅÆÇ	!È\"É	#‡" [auto-raise-screen scr epoch::cursor-warps-to-screen nil raise-screen epoch::warp-mouse / epoch::screen-width 2 0] 7))

(defun find-buffer-other-screen (buffer) "\
Switch to BUFFER in other screen.  If buffer is already in another
screen then select that, else make a new screen." (interactive "BSwitch to buffer other screen: ") (byte-code "ÂˆÆ	!‰ˆ??ƒ Â‚  Ç	!‰ˆŠqˆÂ‰)ˆÈÉ Ê!\"@Ë!Ì P??ƒ; Â‚G ÍÎBÏBD\"‰ˆÐ!ƒV ÑÒ!!‚` ÓÑ\"ˆÔÒ!!ˆÕÖ!!ˆ*‡" [target-buffer buffer nil allowed-screens scr xname get-buffer get-buffer-create delq current-screen epoch::screens-of-buffer buffer-name sys-name create-screen title icon-name screen-mapped-p cursor-to-screen select-screen on-map-do mapraised-screen select-window get-buffer-window] 17))

(defun find-file-other-screen (filename) "\
Find file in other screen" (interactive "FFind file other screen: ") (byte-code "ÂˆÃ	!‰ˆÄ!… Å!‡" [target-buffer filename nil find-file-noselect bufferp find-buffer-other-screen] 4))

(defun switch-screen (&optional scr) "\
Switch to next screen, and move focus there.
   If called with optional argument, then goto that screen instead." (interactive) (byte-code "ÁˆÂƒ ‚ Ã !ˆÄÅ !‡" [scr nil select-screen next-screen cursor-to-screen current-screen] 5))

(defun prev-switch-screen (&optional scr) "\
Switch to next screen, and move focus there.
   If called with optional argument, then goto that screen instead." (interactive) (byte-code "ÁˆÂƒ ‚ Ã !ˆÄÅ !‡" [scr nil select-screen prev-screen cursor-to-screen current-screen] 5))

(defun switch-screen-noselect nil "\
Switch to next screen, without altering the focus.  Used to allow
circulation through screens without moving the mouse" (interactive) (byte-code "ÀˆÁÂ !‡" [nil select-screen next-screen] 3))

(defun dired-other-screen (&optional dirname) "\
Pop up another screen and run dired in it" (interactive "DDired other screen (directory name) ") (byte-code "ÂˆÃÄ !ÅÆ\"ˆÇp!ˆÈ	!)‡" [new-screen dirname nil select-screen create-screen on-map-do (lambda (s) (byte-code "Á!‡" [s cursor-to-screen] 2)) kill-buffer dired] 6))

(defun duplicate-screen nil "\
Makes a copy of current buffer in new screen" (interactive) (byte-code "Áˆp‰ˆÂÃÄÅ!Æ PBÇÅ!Æ PBD\"!ˆÈÉ!ˆÊË !ˆÈÌ!‡" [target-buffer nil select-screen create-screen title buffer-name sys-name icon-name sit-for 2 cursor-to-screen current-screen 0] 11))

(defun send-focus-to-current-screen nil "\
Focus on current screen" (interactive) (byte-code "ÀˆÁÂ !‡" [nil select-screen current-screen] 3))

(defun remove-screen (&optional scr) "\
Delete the argument screen, or current screen if nil.  
  Just an interactive interface to delete-screen" (interactive) (byte-code "ÁˆÂ†	 Ã !ˆÄ ‡" [scr nil delete-screen current-screen focus-current-screen] 4))

(defun focus-current-screen nil "\
Focus on and raise current screen" (interactive) (byte-code "ÀˆÁÂ !‡" [nil cursor-to-screen current-screen] 3))

(defun get-epoch-mode-alist-contents (&optional buffer) "\
find the alist for mode of buffer.  if nil, use current buffer's mode" (byte-code "	… Ä	!Å!ƒ Š	qˆÆ
\"A)‚  Æ
\"A)‡" [buff buffer major-mode epoch-mode-alist get-buffer bufferp assoc] 6))

(modify-syntax-entry 58 "." c-mode-syntax-table)

(put (quote suspend-emacs) (quote disabled) "Suspending a program running in an X window is silly
and you would not be able to start it again.  Just switch windows instead.
")

(setq suspend-hook (quote (lambda nil (error "Suspending an emacs running under X makes no sense"))))

(substitute-key-definition (quote suspend-emacs) nil global-map)

(substitute-key-definition (quote suspend-emacs) nil esc-map)

(substitute-key-definition (quote suspend-emacs) nil ctl-x-map)

(define-prefix-command (quote epoch-cmds-prefix))

(defvar epoch-cmds-map (symbol-function (quote epoch-cmds-prefix)) "\
Keymap for commands that are specific to Epoch, usually bound to C-z.")

(define-prefix-command (quote other-screen-prefix))

(defvar other-screen-map (symbol-function (quote other-screen-prefix)) "\
Keymap for commands that act on the other screen, usually bound to
C-z 4.")

(global-unset-key "")

(global-unset-key "")

(global-set-key "" (quote epoch-cmds-prefix))

(define-key epoch-cmds-map "4" (quote other-screen-prefix))

(define-key other-screen-map "" (quote find-file-other-screen))

(define-key other-screen-map "f" (quote find-file-other-screen))

(define-key other-screen-map "b" (quote find-buffer-other-screen))

(define-key epoch-cmds-map "o" (quote switch-screen))

(define-key epoch-cmds-map "2" (quote duplicate-screen))

(define-key epoch-cmds-map "0" (definteractive (remove-screen)))

(define-key epoch-cmds-map "m" (definteractive (raise-screen (minibuf-screen))))

(define-key epoch-cmds-map "r" (definteractive (raise-screen)))

(define-key epoch-cmds-map "l" (definteractive (lower-screen)))

(define-key epoch-cmds-map "f" (quote focus-current-screen))

(define-key epoch-cmds-map "s" (quote switch-screen-noselect))

(define-key epoch-cmds-map "p" (quote prev-switch-screen))

(define-key epoch-cmds-map "i" (quote iconify-screen))

(define-key epoch-cmds-map "e" (quote display-event-status))
