Debian Codegraph @

psgml-maint.el

raw
1 ;;; psgml-maint.el --- Help functions to maintain PSGML source
2
3 ;; Copyright (C) 1996 Lennart Staflin
4
5 ;; Author: Lennart Staflin <[email protected]>
6 ;; Version: $Id: psgml-maint.el,v 1.8 2005/02/09 15:28:58 lenst Exp $
7 ;; Keywords:
8
9 ;;; This program is free software; you can redistribute it and/or modify
10 ;;; it under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 2, or (at your option)
12 ;;; any later version.
13 ;;;
14 ;;; This program is distributed in the hope that it will be useful,
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; A copy of the GNU General Public License can be obtained from this
20 ;;; program's author (send electronic mail to [email protected]) or from
21 ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
22 ;;; 02139, USA.
23 ;;;
24
25
26 ;;; Commentary:
27
28 ;; This file contanins commands used during installation and
29 ;; compilation of psgml.
30
31 ;; psgml-compile-files Compiles the source files. The version of
32 ;; Emacs used for compilation will determine
33 ;; what files are compiled.
34
35
36 ;;; Code:
37
38 (require 'bytecomp)
39
40 (defconst psgml-common-files
41 '("psgml.el" "psgml-parse.el" "psgml-edit.el" "psgml-dtd.el"
42 "psgml-info.el" "psgml-charent.el" "psgml-api.el" "psgml-sysdep.el"
43 "psgml-ids.el"))
44
45 (defconst psgml-emacs-files '("psgml-other.el"))
46 (defconst psgml-xemacs-files '("psgml-lucid.el"))
47 (defvar psgml-source-dir nil)
48
49 (defconst psgml-elisp-source
50 (append psgml-common-files
51 (cond ((or (string-match "Lucid" emacs-version)
52 (string-match "XEmacs" emacs-version))
53 psgml-xemacs-files)
54 (t
55 psgml-emacs-files))))
56
57
58 (defun psgml-find-source-dir (&optional ask)
59 (if psgml-source-dir
60 t
61 (let ((cand (list "." "./psgml-1.3.2")))
62 (while cand
63 (if (file-exists-p (expand-file-name "psgml-maint.el" (car cand)))
64 (progn
65 (setq psgml-source-dir (expand-file-name "." (car cand))
66 cand nil))
67 (setq cand (cdr cand))))
68 (if (null psgml-source-dir)
69 (if ask
70 (setq psgml-source-dir
71 (expand-file-name
72 (read-file-name "Where is the psgml source? "
73 nil nil t)))
74 (error "No psgml source in current directory"))))))
75
76
77 (defun psgml-compile-files ()
78 "Compile the PSGML source files that needs compilation."
79 (interactive)
80 (psgml-find-source-dir (interactive-p))
81 (let ((default-directory psgml-source-dir)
82 (load-path (cons psgml-source-dir load-path)))
83 (mapcar (function psgml-byte-compile-file)
84 psgml-elisp-source)
85 (message "Done compiling")))
86
87
88 (defun psgml-byte-compile-file (file)
89 (let ((dest (byte-compile-dest-file file)))
90 (if (file-newer-than-file-p file dest)
91 (byte-compile-file file))))
92
93 (defun psgml-install-elc ()
94 "Print list of elc files to install"
95 (let ((destdir (car command-line-args-left)))
96 (princ (mapconcat (function byte-compile-dest-file)
97 psgml-elisp-source " "))))
98
99
100 ;;; psgml-maint.el ends here