32 |
;; Emacs-specific methodology to DCL and TPU commands, so to alleviate |
;; Emacs-specific methodology to DCL and TPU commands, so to alleviate |
33 |
;; this pain, we provide `make-mms-derivative', which given a source |
;; this pain, we provide `make-mms-derivative', which given a source |
34 |
;; FILENAME (under `make-mms-derivative-root-dir'), inserts the file |
;; FILENAME (under `make-mms-derivative-root-dir'), inserts the file |
35 |
;; contents in a new buffer and loads FILENAME.2mms. The elisp in the |
;; contents in a new buffer and loads FILENAME-2mms. The elisp in the |
36 |
;; .2mms file can (do whatever -- it's emacs -- and) arrange to write |
;; -2mms file can (do whatever -- it's emacs -- and) arrange to write |
37 |
;; out the modified buffer after FILENAME.2mms loading by using: |
;; out the modified buffer after FILENAME-2mms loading by using: |
38 |
;; |
;; |
39 |
;; (make-mms-derivative-data 'write-under-root RELATIVE-FILENAME) |
;; (make-mms-derivative-data 'write-under-root RELATIVE-FILENAME) |
40 |
;; |
;; |
41 |
;; where RELATIVE-FILENAME is something like "src/descrip.mms_in_in". |
;; where RELATIVE-FILENAME is something like "src/descrip.mms_in_in". |
42 |
;; Over the long run, the convenience procedures provided (see source) |
;; Over the long run, the convenience procedures provided (see source) |
43 |
;; will be augmented by factoring maximally the .2mms files, squeezing |
;; will be augmented by factoring maximally the -2mms files, squeezing |
44 |
;; as much algorithm out of those nasty heuristics as possible. What |
;; as much algorithm out of those nasty heuristics as possible. What |
45 |
;; makes them nasty is not that they rely on the conventions of the |
;; makes them nasty is not that they rely on the conventions of the |
46 |
;; Emacs makefiles; that's no big deal. What makes them nasty is that |
;; Emacs makefiles; that's no big deal. What makes them nasty is that |
100 |
(file (expand-file-name file))) |
(file (expand-file-name file))) |
101 |
(unless (string-match (concat "^" root) file) |
(unless (string-match (concat "^" root) file) |
102 |
(error "Not under root (%s)" root)) |
(error "Not under root (%s)" root)) |
103 |
(let ((edits-filename (concat file ".2mms"))) |
(let ((edits-filename (concat file "-2mms"))) |
104 |
(unless (file-exists-p edits-filename) |
(unless (file-exists-p edits-filename) |
105 |
(error "Could not find %s" edits-filename)) |
(error "Could not find %s" edits-filename)) |
106 |
(let* ((pre (+ (length root) (if (string= "/" (substring root -1)) 0 1))) |
(let* ((pre (+ (length root) (if (string= "/" (substring root -1)) 0 1))) |