summaryrefslogtreecommitdiff
path: root/elisp/geiser-custom.el
blob: 4b69053797846d818c13b99acf1d781c9d0a634b (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;;; geiser-custom.el -- customization utilities

;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
;; have received a copy of the license along with this program. If
;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>.

;; Start date: Sat Feb 14, 2009 21:49



(require 'font-lock)
(require 'geiser-base)


;;; Customization group:

(defgroup geiser nil
  "Geiser framework for Scheme-Emacs interaction."
  :group 'languages)


;;; Faces:

(defgroup geiser-faces nil
  "Faces used by Geiser."
  :group 'geiser
  :group 'faces)

(defmacro geiser-custom--defface (face def group doc)
  (let ((face (intern (format "geiser-font-lock-%s" face))))
    `(defface ,face (face-default-spec ,def)
       ,(format "Face for %s." doc)
       :group ',group
       :group 'geiser-faces
       :group 'faces)))

(put 'geiser-custom--defface 'lisp-indent-function 1)



;;; Reload support:

(defvar geiser-custom--memoized-vars nil)

(defun geiser-custom--memoize (name)
  (add-to-list 'geiser-custom--memoized-vars name))

(defmacro geiser-custom--defcustom (name &rest body)
  `(progn
     (geiser-custom--memoize ',name)
     (defcustom ,name ,@body)))

(defun geiser-custom--memoized-state ()
  (let ((result))
    (dolist (name geiser-custom--memoized-vars result)
      (when (boundp name)
        (push (cons name (symbol-value name)) result)))))


(put 'geiser-custom--defcustom 'lisp-indent-function 2)


(provide 'geiser-custom)
;;; geiser-custom.el ends here