view lisp/config.el @ 5211:cdca98f2d36f

Move `default-file-system-ignore-case' to C; fix bug in directory hash tables src/ChangeLog addition: 2010-05-16 Aidan Kehoe <kehoea@parhasard.net> Move `default-file-system-ignore-case' to C; pay attention to it in creating the directory hash tables for #'locate-file. Fix a bug where #'eq was specified when creating directory hash tables in dired.c. * config.h.in (DEFAULT_FILE_SYSTEM_IGNORE_CASE): This is 1 on Darwin. * dired.c (make_directory_hash_table): If #'file-system-ignore-case-p gives non-nil for a directory, created the associated hash table with #'equalp as its test. Never use #'eq as a directory hash table test. * fileio.c (vars_of_fileio): Move `default-file-system-ignore-case' here, so it can be a constant boolean reflecting a compile-time #define. * lisp.h: Update the declaration of make_directory_hash_table; remove the declaration of wasteful_word_to_lisp, which was #ifdef'd out. * lread.c (Flocate_file): Take out a debugging statement from this function. (locate_file_refresh_hashing): Call make_directory_hash_table with a Lisp string, not an Ibyte pointer. (vars_of_lread): If DEFAULT_FILE_SYSTEM_IGNORE_CASE is defined, use #'equalp as the hash table test for locate-file-hash-table, not #'equal. * s/win32-common.h (DEFAULT_FILE_SYSTEM_IGNORE_CASE): Case should normally be ignored in file names on Win32. lisp/ChangeLog addition: 2010-05-16 Aidan Kehoe <kehoea@parhasard.net> * files.el (default-file-system-ignore-case): Move this to fileio.c, where it's a constant boolean variable initialised at dump time.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 16 May 2010 12:33:21 +0100
parents 3ecd8885ac67
children 308d34e9f07d
line wrap: on
line source

;;; config.el --- access configuration parameters

;; Copyright (C) 1997 Sun Microsystems, Inc.

;; Author:   Martin Buchholz
;; Keywords: configure

;; This file is part of XEmacs.

;; XEmacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; XEmacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with XEmacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Synched up with: not in FSF.

;;; Commentary:

;;; Code:


(defvar config-value-file (expand-file-name "config.values" doc-directory)
  "File containing configuration parameters and their values.")

(defvar config-value-hash-table nil
  "Hash table to store configuration parameters and their values.")

;;;###autoload
(defun config-value-hash-table ()
  "Return hash table of configuration parameters and their values."
  (when (null config-value-hash-table)
    (setq config-value-hash-table (make-hash-table :size 300))
    (save-excursion
      (let ((buf (get-buffer-create " *Config*")))
	(set-buffer buf)
	(erase-buffer)
	(insert-file-contents config-value-file)
	(goto-char (point-min))
	(condition-case nil
	    (while t
	      (let* ((key (read buf))
		     (value (read buf))
		     (prev (gethash key config-value-hash-table)))
		(cond ((null prev)
		       (puthash key value config-value-hash-table))
		      ((atom prev)
		       (puthash key (list prev value) config-value-hash-table))
		      (t
		       (nconc prev (list value))))))
	  (end-of-file nil)))
      (kill-buffer " *Config*")))
  config-value-hash-table)

;;;###autoload
(defun config-value (config-symbol)
  "Return the value of the configuration parameter CONFIG_SYMBOL."
  (gethash config-symbol (config-value-hash-table)))

(provide 'config)
;;; config.el ends here