1 ;;; config.el --- access configuration parameters
3 ;; Copyright (C) 1997 Sun Microsystems, Inc.
5 ;; Author: Martin Buchholz
8 ;; This file is part of XEmacs.
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)
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.
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.
25 ;;; Synched up with: not in FSF.
32 (defvar config-value-file (expand-file-name "config.values" doc-directory)
33 "File containing configuration parameters and their values.")
35 (defvar config-value-hash-table nil
36 "Hash table to store configuration parameters and their values.")
39 (defun config-value-hash-table ()
40 "Return hash table of configuration parameters and their values."
41 (when (null config-value-hash-table)
42 (setq config-value-hash-table (make-hash-table :size 300))
44 (let ((buf (get-buffer-create " *Config*")))
47 (insert-file-contents config-value-file)
48 (goto-char (point-min))
51 (let* ((key (read buf))
53 (prev (gethash key config-value-hash-table)))
55 (puthash key value config-value-hash-table))
57 (puthash key (list prev value) config-value-hash-table))
59 (nconc prev (list value))))))
61 (kill-buffer " *Config*")))
62 config-value-hash-table)
65 (defun config-value (config-symbol)
66 "Return the value of the configuration parameter CONFIG_SYMBOL."
67 (gethash config-symbol (config-value-hash-table)))
70 ;;; config.el ends here