;;;
;;; Emacs 18 specific code.
;;;
;;; ----------------------------------------------------------------------
;;; This file is part of ILOG Talk.
;;; Inquiries to ILOG S.A.
;;;              9 rue de Verdun, BP 85,
;;;              94253 Gentilly Cedex, France.
;;;
;;; Copyright (c) 1993-1996 by ILOG
;;; ----------------------------------------------------------------------
;;;

;; Setup
;; -----
;;

(defun add-hook (hook function)
  (let ((hooks (symbol-value hook)))
    (if (not (memq function hooks))
	(set hook (cons function hooks)))))

(defun tm:talk-mode-variables-specific ()
  (make-local-variable 'blink-paren-hook)
  (setq blink-paren-hook 'tm:blink-matching-open)
  (make-local-variable 'write-file-hooks)
  (add-hook 'write-file-hooks 'tm:run-write-contents-hook)
  (setq overlay-arrow-string ">"))

(defvar tm:indent-property 'lisp-indent-hook)


;; Window selection
;; ----------------
;;

(fset 'tm:select-window 'select-window)

(defun tm:display-buffer (buffer herep)
  "If HEREP is true, display BUFFER in the current window. Otherwise,
display BUFFER in another window."
  (if (not herep)
      (display-buffer buffer)
    (let ((window (selected-window)))
      (set-window-buffer window buffer)
      window)))

(defun tm:delete-screen ()
  ())

(defun tm:unget-char (char)
  (setq unread-command-char char))

(defun tm:raise-window-screen (window)
  ())

(fset 'tm:other-window 'other-window)

(fset 'tm:get-buffer-window 'get-buffer-window)

(fset 'tm:buffer-list 'buffer-list)


;; Text hiliting
;; -------------
;;

(defun tm:insert-title (text)
  "Insert TEXT as a title."
  (let ((column (current-column)))
    (insert text)
    (newline)
    (indent-to-column column)
    (insert-char ?- (length text))))


;; Events
;; ------
;;

(defun tm:read-event ()
  (read-char))

(defun tm:event-key (event)
  (char-to-string event))

(defun tm:unread-event (event)
  (setq unread-command-char event))

(defun tm:key-string (key)
  key)

(provide 'talk-mode18)
