summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2003-11-25 02:47:22 +0000
committerThien-Thi Nguyen <ttn@gnuvola.org>2003-11-25 02:47:22 +0000
commit26d7d4bb9f122b9632b351a7dbe3105bc9d46364 (patch)
treef0c31643398f11f3abaec5856cf988340ee47b87 /vms
parentdef6201d44dbf4b5713ac5bc604f18afd7637e58 (diff)
downloademacs-26d7d4bb9f122b9632b351a7dbe3105bc9d46364.tar.gz
(make-mms-derivative-load-edits-file): Rewrite
to avoid external programs; do all processing inside Emacs.
Diffstat (limited to 'vms')
-rw-r--r--vms/make-mms-derivative.el33
1 files changed, 23 insertions, 10 deletions
diff --git a/vms/make-mms-derivative.el b/vms/make-mms-derivative.el
index 390d08d3dd4..1ad2af4e388 100644
--- a/vms/make-mms-derivative.el
+++ b/vms/make-mms-derivative.el
@@ -79,16 +79,29 @@
(defun make-mms-derivative-load-edits-file (name)
(make-mms-derivative-data 'edits-filename name)
- (let ((i 0) tmp res)
- (while (progn
- (setq tmp
- (shell-command-to-string
- (format "grep '^;;;%s;;' %s | sed 's/^;;;[0-9][0-9]*;;//g'"
- i name)))
- (not (string= "" tmp)))
- (setq res (cons (cons i tmp) res)
- i (1+ i)))
- (make-mms-derivative-data 'raw-data res))
+ (let (raw-data
+ (cur (current-buffer))
+ (wbuf (get-buffer-create "*make-mms-derivative-load-edits-file work")))
+ (set-buffer wbuf)
+ (insert-file-contents name)
+ (keep-lines "^;;;[0-9]+;;")
+ (goto-char (point-max))
+ (while (re-search-backward "^;;;\\([0-9]+\\);;\\(.*\\)$" (point-min) t)
+ (let* ((i (string-to-number (match-string 1)))
+ (line (match-string 2))
+ (look (assq i raw-data)))
+ (if look
+ (setcdr look (cons line (cdr look)))
+ (setq raw-data (cons (list i line) raw-data)))))
+ (kill-buffer wbuf)
+ (set-buffer cur)
+ (mapcar '(lambda (ent)
+ (setcdr ent (mapconcat '(lambda (line)
+ (concat line "\n"))
+ (cdr ent)
+ "")))
+ raw-data)
+ (make-mms-derivative-data 'raw-data raw-data))
(load name))
(defun make-mms-derivative-insert-raw-data (n)