- ;; Bind keywords.
- (dolist (keyword '(:button-keymap :data :file :mime-handle
- :key-type :value-type
- :ascent :foreground :help))
- (set keyword keyword))))
-
-;; If you are using Mule 2.3 based on Emacs 19.34, you may also put the
-;; following lines in your .emacs file, before gnus related modules are
-;; loaded. It is not always necessary. However if it is done, you will
-;; be able to load or evaluate gnus related *.el (not compiled) files.
-;; ------ cut here ------ cut here ------ cut here ------ cut here ------
-(if (boundp 'MULE)
- (progn
- (setq :version ':version
- :set-after ':set-after)
- (require 'custom)
- (defadvice custom-handle-keyword
- (around dont-signal-an-error-even-if-unsupported-keyword-is-given
- activate)
- "Don't signal an error even if unsupported keyword is given."
- (if (not (memq (ad-get-arg 1) '(:version :set-after)))
- ad-do-it))))
-;; ------ cut here ------ cut here ------ cut here ------ cut here ------
+ (defun dgnushack-bind-colon-keywords ()
+ "Bind all the colon keywords for old Emacsen."
+ (let ((cache (expand-file-name "dgnuskwds.el" srcdir))
+ (makefile (expand-file-name "Makefile" srcdir))
+ (buffer (get-buffer-create " *colon keywords*"))
+ keywords ignores files file dirs dir form elem make-backup-files)
+ (save-excursion
+ (set-buffer buffer)
+ (let (buffer-file-format
+ format-alist
+ insert-file-contents-post-hook
+ insert-file-contents-pre-hook
+ jam-zcat-filename-list
+ jka-compr-compression-info-list)
+ (if (and (file-exists-p cache)
+ (file-exists-p makefile)
+ (file-newer-than-file-p cache makefile))
+ (progn
+ (insert-file-contents cache nil nil nil t)
+ (setq keywords (read buffer)))
+ (setq
+ ignores
+ '(:symbol-for-testing-whether-colon-keyword-is-available-or-not
+ ;; The following keywords will be bound by CUSTOM.
+ :get :group :initialize :link :load :options :prefix
+ :require :set :tag :type)
+ files (list (locate-library "semi-def")
+ (locate-library "mailcap")
+ (locate-library "mime-def")
+ (locate-library "path-util")
+ (locate-library "poem"))
+ dirs (list (file-name-as-directory (expand-file-name srcdir))))
+ (while files
+ (when (setq file (pop files))
+ (setq dir (file-name-directory file))
+ (unless (member dir dirs)
+ (push dir dirs))))
+ (message "Searching for all the colon keywords in:")
+ (while dirs
+ (setq dir (pop dirs))
+ (message " %s..." dir)
+ (setq files (directory-files dir t
+ "\\.el\\(\\.gz\\|\\.bz2\\)?$"))
+ (while files
+ (setq file (pop files))
+ (if (string-match "\\(\\.gz$\\)\\|\\.bz2$" file)
+ (let ((temp (expand-file-name "dgnustemp.el" srcdir)))
+ (when
+ (let* ((binary (if (boundp 'MULE)
+ '*noconv*
+ 'binary))
+ (coding-system-for-read binary)
+ (coding-system-for-write binary)
+ (input-coding-system binary)
+ (output-coding-system binary)
+ (default-process-coding-system
+ (cons binary binary))
+ call-process-hook)
+ (insert-file-contents file nil nil nil t)
+ (when
+ (condition-case code
+ (progn
+ (if (match-beginning 1)
+ (call-process-region
+ (point-min) (point-max)
+ "gzip" t buffer nil "-cd")
+ (call-process-region
+ (point-min) (point-max)
+ "bzip2" t buffer nil "-d"))
+ t)
+ (error
+ (erase-buffer)
+ (message "In file %s: %s" file code)
+ nil))
+ (write-region (point-min) (point-max) temp
+ nil 'silent)
+ t))
+ (unwind-protect
+ (insert-file-contents temp nil nil nil t)
+ (delete-file temp))))
+ (insert-file-contents file nil nil nil t))
+ (while (setq form (condition-case nil
+ (read buffer)
+ (error nil)))
+ (when (listp form)
+ (while form
+ (setq elem (pop form))
+ (unless (memq (car-safe elem)
+ '(defcustom defface defgroup
+ define-widget quote))
+ (while (consp elem)
+ (push (car elem) form)
+ (setq elem (cdr elem)))
+ (when (and elem
+ (symbolp elem)
+ (not (eq ': elem))
+ (eq ?: (aref (symbol-name elem) 0))
+ (not (memq elem ignores))
+ (not (memq elem keywords)))
+ (push elem keywords))))))))
+ (setq keywords (sort keywords
+ (lambda (a b)
+ (string-lessp (symbol-name a)
+ (symbol-name b)))))
+ (erase-buffer)
+ (insert (format "%s" keywords))
+ (write-region (point-min) (point) cache nil 'silent)
+ (message
+ "The following colon keywords will be bound at run-time:\n %s"
+ keywords))))
+ (kill-buffer buffer)
+ (defconst dgnushack-colon-keywords keywords)
+ (while keywords
+ (set (car keywords) (car keywords))
+ (setq keywords (cdr keywords)))))
+ (byte-compile 'dgnushack-bind-colon-keywords)
+ (dgnushack-bind-colon-keywords)))
+
+(when (boundp 'MULE)
+ (setq :version ':version
+ :set-after ':set-after)
+ (require 'custom)
+ (defadvice custom-handle-keyword
+ (around dont-signal-an-error-even-if-unsupported-keyword-is-given
+ activate)
+ "Don't signal an error even if unsupported keyword is given."
+ (if (not (memq (ad-get-arg 1) '(:version :set-after)))
+ ad-do-it)))