source: trunk/j/examples/init.lisp @ 4240

Last change on this file since 4240 was 4240, checked in by piso, 18 years ago

update-check-enabled.lisp

File size: 2.5 KB
Line 
1;;; init.lisp
2;;; $Id: init.lisp,v 1.14 2003-10-07 14:30:16 piso Exp $
3
4;;; ~/.j/init.lisp (if it exists) is loaded automatically when j starts up.
5
6(defun load-theme (name)
7  (let ((filename (concatenate 'string "/home/peter/depot/j/themes/" name ".lisp")))
8    (unless (probe-file filename)
9      (error "file not found: ~A" filename))
10    (kill-theme)
11    (load filename)
12    (reset-display)
13    t))
14
15(defun hostname ()
16  (when (probe-file "/etc/hostname")
17    (with-open-file (f "/etc/hostname")
18      (read-line f))))
19
20;; Use Kodiak on prufrock, AnokhaClassic on the laptops.
21(let ((hostname (hostname)))
22  (if (and hostname (search "prufrock" hostname))
23      (load-theme "Kodiak")
24      (load-theme "AnokhaClassic")))
25
26(defun java-version ()
27  (jstatic "getProperty" "java.lang.System" "java.version"))
28
29(defun adjust-appearance ()
30  (when (member (subseq (java-version) 0 5) '("1.4.0" "1.4.1" "1.4.2") :test #'string=)
31    (set-global-property "adjustAscent" -2)
32    (set-global-property "adjustLeading" -2)
33    (reset-display)))
34
35;; Do it now!
36(adjust-appearance)
37
38;; Turn off the remove-trailing-whitespace preference for files in the
39;; directory ~/gcl/ansi-tests.
40(defun my-open-file-hook (buf)
41  (let ((filename (buffer-pathname buf)))
42    (when (and filename
43               (string= (directory-namestring filename)
44                        "/home/peter/gcl/ansi-tests/"))
45      (setf (variable-value 'remove-trailing-whitespace :buffer) nil))))
46
47(add-hook 'open-file-hook 'my-open-file-hook)
48
49;; Call ADJUST-APPEARANCE after saving ~/.j/prefs.
50(defun my-after-save-hook (buf)
51  (let ((filename (buffer-pathname buf)))
52    (when (string= filename "/home/peter/.j/prefs")
53      (adjust-appearance))))
54
55(add-hook 'after-save-hook 'my-after-save-hook)
56
57(defun reset-incoming-filters ()
58  (jstatic "resetIncomingFilters" "org.armedbear.j.mail.IncomingFilter"))
59
60(defun add-incoming-filter (mailbox pattern action parameter)
61  (jstatic "addIncomingFilter" "org.armedbear.j.mail.IncomingFilter"
62           mailbox pattern action parameter))
63
64(add-hook 'mailbox-mode-hook
65          (lambda ()
66            (reset-incoming-filters)
67            (add-incoming-filter "inbox"
68                                 "~C linux-kernel"
69                                 "move"
70                                 "{annie}mail/linux-kernel")))
71
72(when (probe-file "/home/peter/.j/key-pressed.lisp")
73  (load "/home/peter/.j/key-pressed.lisp"))
74
75(when (probe-file "/home/peter/.j/update-check-enabled.lisp")
76  (load "/home/peter/.j/update-check-enabled.lisp"))
Note: See TracBrowser for help on using the repository browser.