File: slime-banner.el

package info (click to toggle)
slime 1:20080223.dfsg-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,600 kB
  • ctags: 3,345
  • sloc: lisp: 30,707; sh: 163; makefile: 119; awk: 10
file content (44 lines) | stat: -rw-r--r-- 1,501 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;;; slime-banner.el -- Persistent header line and startup animation
;;
;; Authors: Helmut Eller  <heller@common-lisp.net>
;;          Luke Gorrie  <luke@synap.se>
;; License: GNU GPL (same license as Emacs)
;;
;;; Installation:
;;
;; Add something like this to your .emacs: 
;;
;;   (add-to-list 'load-path ".../slime/contrib")
;;   (add-hook 'slime-load-hook (lambda () (require 'slime-banner)))

(defcustom slime-startup-animation (fboundp 'animate-string)
   "Enable the startup animation."
   :type '(choice (const :tag "Enable" t) (const :tag "Disable" nil))
   :group 'slime-ui)

(defcustom slime-header-line-p (boundp 'header-line-format)
  "If non-nil, display a header line in Slime buffers."
  :type 'boolean
  :group 'slime-repl)

(defun slime-startup-message ()
  (when slime-header-line-p
    (setq header-line-format 
          (format "%s  Port: %s  Pid: %s"
                  (slime-lisp-implementation-type)
                  (slime-connection-port (slime-connection))
                  (slime-pid))))
  (when (zerop (buffer-size))
    (let ((welcome (concat "; SLIME " (or (slime-changelog-date) 
                                          "- ChangeLog file not found"))))
      (if slime-startup-animation
          (animate-string welcome 0 0) 
        (insert welcome)))))

(defun slime-banner-init ()
  (setq slime-repl-banner-function 'slime-startup-message))

(defun slime-banner-unload ()
  (setq slime-repl-banner-function 'slime-repl-insert-banner))

(provide 'slime-banner)