1
;;; slime-typeout-frame.el --- display some message in a dedicated frame
3
;; Author: Luke Gorrie <luke@synap.se>
4
;; License: GNU GPL (same license as Emacs)
8
;; Add something like this to your .emacs:
10
;; (add-to-list 'load-path "<directory-of-this-file>")
11
;; (add-hook 'slime-load-hook (lambda () (require 'slime-typeout-frame)))
17
;; When a "typeout frame" exists it is used to display certain
18
;; messages instead of the echo area or pop-up windows.
20
(defvar slime-typeout-window nil
21
"The current typeout window.")
23
(defvar slime-typeout-frame-properties
24
'((height . 10) (minibuffer . nil))
25
"The typeout frame properties (passed to `make-frame').")
27
(defun slime-typeout-active-p ()
28
(and slime-typeout-window
29
(window-live-p slime-typeout-window)))
31
(defun slime-typeout-message (format-string &rest format-args)
32
(slime-ensure-typeout-frame)
33
(with-current-buffer (window-buffer slime-typeout-window)
35
(insert (apply #'format format-string format-args))))
37
(defun slime-make-typeout-frame ()
38
"Create a frame for displaying messages (e.g. arglists)."
40
(let ((frame (make-frame slime-typeout-frame-properties)))
42
(select-window (frame-selected-window frame))
43
(switch-to-buffer "*SLIME-Typeout*")
44
(setq slime-typeout-window (selected-window)))))
46
(defun slime-ensure-typeout-frame ()
47
"Create the typeout frame unless it already exists."
49
(unless (slime-typeout-active-p)
50
(slime-make-typeout-frame)))
52
(defun slime-typeout-autodoc-message (doc)
53
(setq slime-autodoc-last-message "") ; no need for refreshing
54
(slime-typeout-message "%s" doc))
59
(defvar slime-typeout-frame-unbind-stack ())
61
(defun slime-typeout-frame-init ()
62
(add-hook 'slime-connected-hook 'slime-ensure-typeout-frame)
63
(loop for (var value) in
64
'((slime-message-function #'slime-typeout-message)
65
(slime-background-message-function #'slime-typeout-message)
66
(slime-autodoc-message-function #'slime-typeout-autodoc-message))
67
do (slime-typeout-frame-init-var var value)))
69
(defun slime-typeout-frame-init-var (var value)
70
(push (list var (if (boundp var) (symbol-value var) 'slime-unbound))
71
slime-typeout-frame-unbind-stack)
74
(defun slime-typeout-frame-unload ()
75
(remove-hook 'slime-connected-hook 'slime-ensure-typeout-frame)
76
(loop for (var value) in slime-typeout-frame-unbind-stack
77
do (cond ((eq var 'slime-unbound) (makunbound var))
78
(t (set var value)))))
80
(provide 'slime-typeout-frame)