Mercurial > hg > xemacs-beta
comparison lisp/utils/config.el @ 175:2d532a89d707 r20-3b14
Import from CVS: tag r20-3b14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:50:14 +0200 |
parents | |
children | 9ad43877534d |
comparison
equal
deleted
inserted
replaced
174:bb3568571b84 | 175:2d532a89d707 |
---|---|
1 ;;; config.el --- access configuration parameters | |
2 | |
3 ;; Copyright (C) 1997 Sun Microsystems, Inc. | |
4 | |
5 ;; Author: Martin Buchholz | |
6 ;; Keywords: configure | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
10 ;; XEmacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; XEmacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with XEmacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Synched up with: not in FSF. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;;; Code: | |
30 | |
31 | |
32 (defvar config-value-file (expand-file-name "config.values" exec-directory) | |
33 "File containing configuration parameters and their values.") | |
34 | |
35 (defvar config-value-hash-table nil | |
36 "Hashtable to store configuration parameters and their values.") | |
37 | |
38 ;;;###autoload | |
39 (defun config-value-hash-table () | |
40 "Returns hashtable of configuration parameters and their values." | |
41 (when (null config-value-hash-table) | |
42 (setq config-value-hash-table (make-hashtable 300)) | |
43 (save-excursion | |
44 (let ((buf (get-buffer-create " *Config*"))) | |
45 (set-buffer buf) | |
46 (erase-buffer) | |
47 (insert-file-contents config-value-file) | |
48 (goto-char (point-min)) | |
49 (condition-case nil | |
50 (while t | |
51 (puthash (read buf) (read buf) config-value-hash-table)) | |
52 (end-of-file nil))) | |
53 (kill-buffer " *Config*"))) | |
54 config-value-hash-table) | |
55 | |
56 ;;;###autoload | |
57 (defun config-value (config-symbol) | |
58 "Return the value of the configuration parameter CONFIG_SYMBOL." | |
59 (gethash config-symbol (config-value-hash-table))) | |
60 | |
61 (provide 'config) | |
62 ;;; config.el ends here |