;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU Emacs EMACS_VERSION default settings for Vine Linux
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defcustom emacs-ime (getenv "EMACS_IME")
  "A variable of default Input Method Editor"
  :type 'string)
(if (null emacs-ime)
    (setq emacs-ime "scim"))

(defcustom vine-default t
  "A boolean for all Vine Linux default settings"
  :type 'boolean)
(if (equal (getenv "LOGNAME") "root") 
    (setq vine-default nil))

(defcustom vine-default-base t
  "A boolean for vine-default-base"
  :type 'boolean)

(defcustom vine-default-faces t
  "A boolean for vine-default-faces"
  :type 'boolean)

(defvar vine-default-setup-hook nil
  "List of functions to be called at vine-default-setup")

(defvar after-vine-default-setup-hook nil 
  "This hook is obsolete! Please do not use this hook. 
   List of functions to be called at the end of vine-default-setup")

(defun vine-default-setup ()
  "A function for setup to default configurations of Vine Linux"
  (if vine-default
      (progn
	(message "Starting vine-default-setup ...")
	(if vine-default-base (require 'vine-default-base))
	(if vine-default-faces (require 'vine-default-faces))
	(run-hooks 'vine-default-setup-hook)
	(run-hooks 'after-vine-default-setup-hook);; obsolete
	)
    )
  )

(defun show-vine-default ()
  "A function to show current vine-default configurations"
  (interactive)
  (shell-command 
   "/usr/lib/emacsen-common/show-vine-default.sh EMACS_VERSION"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; run functions from the /etc/emacs-EMACS_VERSION/site-start.d directory
;;; Files in this directory ending with ".el" are run on startup
(mapc 'load (directory-files "/etc/emacs-EMACS_VERSION/site-start.d" t "\\.el\\'"))

;;; load local configuration
(if (file-exists-p (expand-file-name "/etc/emacs/emacs23-local.el"))
    (load (expand-file-name "/etc/emacs/emacs22-local.el")))

;;; load vine-default configuration per user before vine-default-setup
(if (file-exists-p (expand-file-name "~/.emacs.d/emacs22-vine-default.el"))
    (load (expand-file-name "~/.emacs.d/emacs22-vine-default.el")))

;;; run vine-default-setup
(vine-default-setup)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:
