Japanese translation of message catalog for Sawfish Window-Manager
リビジョン | 5af7d166bf55554d6487a60f0e659370ee20c1e9 (tree) |
---|---|
日時 | 1999-08-08 05:18:14 |
作者 | john <john> |
コミッター | john |
new file, inspired by Emacs' customize system. This file allows Lisp
libraries to declare their configurable settings (and their types)
@@ -0,0 +1,108 @@ | ||
1 | +;; custom.jl -- Emacs-like ``customizing'' (but more simple) | |
2 | +;; $Id$ | |
3 | + | |
4 | +;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk> | |
5 | + | |
6 | +;; This file is part of sawmill. | |
7 | + | |
8 | +;; sawmill is free software; you can redistribute it and/or modify it | |
9 | +;; under the terms of the GNU General Public License as published by | |
10 | +;; the Free Software Foundation; either version 2, or (at your option) | |
11 | +;; any later version. | |
12 | + | |
13 | +;; sawmill is distributed in the hope that it will be useful, but | |
14 | +;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | +;; GNU General Public License for more details. | |
17 | + | |
18 | +;; You should have received a copy of the GNU General Public License | |
19 | +;; along with sawmill; see the file COPYING. If not, write to | |
20 | +;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | + | |
22 | +(provide 'custom) | |
23 | + | |
24 | +(defvar custom-groups nil) | |
25 | + | |
26 | +(defvar custom-required nil | |
27 | + "List of features to load before running customize.") | |
28 | + | |
29 | +;; (defcustom VARIABLE VALUE DOC &rest CUSTOM-KEYS) | |
30 | + | |
31 | +;; where CUSTOM-KEYS is a plist containing any of the following: | |
32 | + | |
33 | +;; :group GROUP | |
34 | +;; :require FEATURE | |
35 | +;; :type TYPE | |
36 | +;; :allow-nil t | |
37 | + | |
38 | +;; TYPE may be `boolean', `number', `string', `(set SYMBOLS..)', | |
39 | +;; `file-name', `program-name' | |
40 | + | |
41 | +(defmacro defcustom (symbol value doc &rest keys) | |
42 | + (list 'defvar | |
43 | + symbol | |
44 | + (list 'custom-declare-variable | |
45 | + (list 'quote symbol) value (list 'quote keys)) | |
46 | + doc)) | |
47 | + | |
48 | +(defmacro defgroup (symbol doc) | |
49 | + (list 'custom-declare-group (list 'quote symbol) doc)) | |
50 | + | |
51 | +(defun custom-declare-variable (symbol value keys) | |
52 | + (let | |
53 | + (tem) | |
54 | + (while keys | |
55 | + (setq tem (car keys)) | |
56 | + (setq keys (cdr keys)) | |
57 | + (cond ((eq tem ':group) | |
58 | + (put symbol 'custom-group (car keys)) | |
59 | + (custom-add-to-group symbol (car keys))) | |
60 | + ((eq tem ':require) | |
61 | + (put symbol 'custom-require (car keys))) | |
62 | + ((eq tem ':type) | |
63 | + (put symbol 'custom-type (car keys))) | |
64 | + ((eq tem ':allow-nil) | |
65 | + (put symbol 'custom-allow-nil (car keys)))) | |
66 | + (setq keys (cdr keys))) | |
67 | + value)) | |
68 | + | |
69 | +(defun custom-declare-group (group &optional doc) | |
70 | + (unless (assq group custom-groups) | |
71 | + (setq custom-groups (nconc custom-groups (list (list group))))) | |
72 | + (when doc | |
73 | + (put group 'custom-group-doc doc))) | |
74 | + | |
75 | +(defun custom-add-to-group (symbol group) | |
76 | + (let | |
77 | + ((group-list (assq group custom-groups))) | |
78 | + (unless group-list | |
79 | + (custom-declare-group group) | |
80 | + (setq group-list (assq group custom-groups))) | |
81 | + (rplacd group-list (nconc (cdr group-list) (list symbol))))) | |
82 | + | |
83 | +(defun custom-set-variable (symbol value &optional require) | |
84 | + (when require | |
85 | + (require require)) | |
86 | + (set symbol value)) | |
87 | + | |
88 | + | |
89 | +;; default groups | |
90 | + | |
91 | +(defgroup focus "Focus") | |
92 | +(defgroup move "Move/Resize") | |
93 | +(defgroup menus "Menus") | |
94 | +(defgroup workspace "Workspaces") | |
95 | +(defgroup placement "Placement") | |
96 | +(defgroup misc "Miscellaneous") | |
97 | +(defgroup customize "Customization") | |
98 | + | |
99 | + | |
100 | + | |
101 | +(defcustom custom-user-file "~/.sawmill-custom" | |
102 | + "File used to store user's configuration settings." | |
103 | + :group customize | |
104 | + :type file-name) | |
105 | + | |
106 | +(defun custom-load-user-file () | |
107 | + (when (file-exists-p custom-user-file) | |
108 | + (load custom-user-file t t t))) |
@@ -0,0 +1,108 @@ | ||
1 | +;; custom.jl -- Emacs-like ``customizing'' (but more simple) | |
2 | +;; $Id$ | |
3 | + | |
4 | +;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk> | |
5 | + | |
6 | +;; This file is part of sawmill. | |
7 | + | |
8 | +;; sawmill is free software; you can redistribute it and/or modify it | |
9 | +;; under the terms of the GNU General Public License as published by | |
10 | +;; the Free Software Foundation; either version 2, or (at your option) | |
11 | +;; any later version. | |
12 | + | |
13 | +;; sawmill is distributed in the hope that it will be useful, but | |
14 | +;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | +;; GNU General Public License for more details. | |
17 | + | |
18 | +;; You should have received a copy of the GNU General Public License | |
19 | +;; along with sawmill; see the file COPYING. If not, write to | |
20 | +;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | + | |
22 | +(provide 'custom) | |
23 | + | |
24 | +(defvar custom-groups nil) | |
25 | + | |
26 | +(defvar custom-required nil | |
27 | + "List of features to load before running customize.") | |
28 | + | |
29 | +;; (defcustom VARIABLE VALUE DOC &rest CUSTOM-KEYS) | |
30 | + | |
31 | +;; where CUSTOM-KEYS is a plist containing any of the following: | |
32 | + | |
33 | +;; :group GROUP | |
34 | +;; :require FEATURE | |
35 | +;; :type TYPE | |
36 | +;; :allow-nil t | |
37 | + | |
38 | +;; TYPE may be `boolean', `number', `string', `(set SYMBOLS..)', | |
39 | +;; `file-name', `program-name' | |
40 | + | |
41 | +(defmacro defcustom (symbol value doc &rest keys) | |
42 | + (list 'defvar | |
43 | + symbol | |
44 | + (list 'custom-declare-variable | |
45 | + (list 'quote symbol) value (list 'quote keys)) | |
46 | + doc)) | |
47 | + | |
48 | +(defmacro defgroup (symbol doc) | |
49 | + (list 'custom-declare-group (list 'quote symbol) doc)) | |
50 | + | |
51 | +(defun custom-declare-variable (symbol value keys) | |
52 | + (let | |
53 | + (tem) | |
54 | + (while keys | |
55 | + (setq tem (car keys)) | |
56 | + (setq keys (cdr keys)) | |
57 | + (cond ((eq tem ':group) | |
58 | + (put symbol 'custom-group (car keys)) | |
59 | + (custom-add-to-group symbol (car keys))) | |
60 | + ((eq tem ':require) | |
61 | + (put symbol 'custom-require (car keys))) | |
62 | + ((eq tem ':type) | |
63 | + (put symbol 'custom-type (car keys))) | |
64 | + ((eq tem ':allow-nil) | |
65 | + (put symbol 'custom-allow-nil (car keys)))) | |
66 | + (setq keys (cdr keys))) | |
67 | + value)) | |
68 | + | |
69 | +(defun custom-declare-group (group &optional doc) | |
70 | + (unless (assq group custom-groups) | |
71 | + (setq custom-groups (nconc custom-groups (list (list group))))) | |
72 | + (when doc | |
73 | + (put group 'custom-group-doc doc))) | |
74 | + | |
75 | +(defun custom-add-to-group (symbol group) | |
76 | + (let | |
77 | + ((group-list (assq group custom-groups))) | |
78 | + (unless group-list | |
79 | + (custom-declare-group group) | |
80 | + (setq group-list (assq group custom-groups))) | |
81 | + (rplacd group-list (nconc (cdr group-list) (list symbol))))) | |
82 | + | |
83 | +(defun custom-set-variable (symbol value &optional require) | |
84 | + (when require | |
85 | + (require require)) | |
86 | + (set symbol value)) | |
87 | + | |
88 | + | |
89 | +;; default groups | |
90 | + | |
91 | +(defgroup focus "Focus") | |
92 | +(defgroup move "Move/Resize") | |
93 | +(defgroup menus "Menus") | |
94 | +(defgroup workspace "Workspaces") | |
95 | +(defgroup placement "Placement") | |
96 | +(defgroup misc "Miscellaneous") | |
97 | +(defgroup customize "Customization") | |
98 | + | |
99 | + | |
100 | + | |
101 | +(defcustom custom-user-file "~/.sawmill-custom" | |
102 | + "File used to store user's configuration settings." | |
103 | + :group customize | |
104 | + :type file-name) | |
105 | + | |
106 | +(defun custom-load-user-file () | |
107 | + (when (file-exists-p custom-user-file) | |
108 | + (load custom-user-file t t t))) |