3
(defun replace-in-files (matches files)
6
(switch-to-buffer (or (find-buffer-visiting file) (find-file file)))
9
(let ((case-fold-search nil))
11
(while (search-forward-regexp (car x) nil t)
12
(replace-match (cdr x) nil t)))
18
(defun ecl-load-symbols ()
21
(while (re-search-forward ";;; Address = \\([0-9a-f]*\\)" nil t)
22
(let ((address (buffer-substring (match-beginning 1)
24
(re-search-backward ";;; Loading \\(/.*\.o\\)$")
25
(let ((file (buffer-substring (match-beginning 1)
27
(print file) (print address)
29
(gud-call (format "add-symbol-file %s 0x%s" file address))))
32
(defvar ecl-search-string)
34
(defun query-replace-ecl (from-string to-string &optional delimited start end)
35
(interactive (query-replace-read-args "Query replace" nil))
36
(setq ecl-search-string from-string)
37
(let ((remaining (member (buffer-file-name (current-buffer)) ecl-files)))
38
(dolist (i (or remaining ecl-files))
39
(let ((b (find-buffer-visiting i)))
40
(unless (equal b (current-buffer))
42
(beginning-of-buffer)))
43
(perform-replace from-string to-string t nil delimited nil nil
46
(defun search-ecl (string)
47
(interactive "sString: ")
48
(setq ecl-search-string string)
49
(let ((remaining (member (buffer-file-name (current-buffer)) ecl-files)))
50
(dolist (i (or remaining ecl-files))
51
(let ((b (find-buffer-visiting i)))
52
(unless (equal b (current-buffer))
55
(beginning-of-buffer)))
57
(setq case-fold-search t)
58
(if (search-forward string nil t)
64
(let ((case-fold-search nil))
65
(while (re-search-forward "\\bL\\([XA_a-z=<>/0-9*]+\\)" nil t)
66
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
67
(a (buffer-substring (match-beginning 1) (match-end 1))))
68
(dotimes (i (length a))
73
(setq a (concat "@" a))
74
(when (y-or-n-p (concat "Replace " b " with " a " "))
75
(replace-match a t t))))))
77
(let ((case-fold-search nil))
78
(while (re-search-forward "\\bsiL\\([XA_a-z=<>/0-9*]+\\)" nil t)
79
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
80
(a (buffer-substring (match-beginning 1) (match-end 1))))
81
(dotimes (i (length a))
86
(setq a (concat "@si::" a))
87
(when (y-or-n-p (concat "Replace " b " with " a " "))
88
(replace-match a t t))))))
90
(let ((case-fold-search nil))
91
(while (re-search-forward "\\bS\\([XA_a-z=<>/0-9*]+\\)" nil t)
92
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
93
(a (buffer-substring (match-beginning 1) (match-end 1))))
94
(dotimes (i (length a))
99
(setq a (concat "@'" a "'"))
100
(when (y-or-n-p (concat "Replace " b " with " a " "))
101
(replace-match a t t))))))
103
(let ((case-fold-search nil))
104
(while (re-search-forward "\\bclS\\([XA_a-z=<>/0-9*]+\\)" nil t)
105
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
106
(a (buffer-substring (match-beginning 1) (match-end 1))))
107
(dotimes (i (length a))
112
(setq a (concat "@'" a "'"))
113
(when (y-or-n-p (concat "Replace " b " with " a " "))
114
(replace-match a t t))))))
116
(let ((case-fold-search nil))
117
(while (re-search-forward "\\bV\\([XA_a-z=<>/0-9*]+\\)" nil t)
118
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
119
(a (buffer-substring (match-beginning 1) (match-end 1))))
120
(dotimes (i (length a))
125
(setq a (concat "@'*" a "*'"))
126
(when (y-or-n-p (concat "Replace " b " with " a " "))
127
(replace-match a t t))))))
129
(let ((case-fold-search nil))
130
(while (re-search-forward "\\bsiS\\([XA_a-z=<>/0-9*]+\\)" nil t)
131
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
132
(a (buffer-substring (match-beginning 1) (match-end 1))))
133
(dotimes (i (length a))
138
(setq a (concat "@'si::" a "'"))
139
(when (y-or-n-p (concat "Replace " b " with " a " "))
140
(replace-match a t t))))))
142
(let ((case-fold-search nil))
143
(while (re-search-forward "\\bsiV\\([XA_a-z=<>/0-9*]+\\)" nil t)
144
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
145
(a (buffer-substring (match-beginning 1) (match-end 1))))
146
(dotimes (i (length a))
151
(setq a (concat "@'si::*" a "*'"))
152
(when (y-or-n-p (concat "Replace " b " with " a " "))
153
(replace-match a t t))))))
155
(let ((case-fold-search nil))
156
(while (re-search-forward "\\bK\\([XA_a-z=<>/0-9*]+\\)" nil t)
157
(let* ((b (buffer-substring (match-beginning 0) (match-end 0)))
158
(a (buffer-substring (match-beginning 1) (match-end 1))))
159
(dotimes (i (length a))
164
(setq a (concat "@':" a "'"))
165
(when (y-or-n-p (concat "Replace " b " with " a " "))
166
(replace-match a t t)))))))
168
(defun search-next-ecl ()
170
(search-ecl ecl-search-string))
172
(defun back-to-emacs ()
174
(switch-to-buffer "emacs.el"))
178
(let ((remaining (member (buffer-file-name (current-buffer)) ecl-files)))
179
(when (cdr remaining)
180
(switch-to-buffer (find-buffer-visiting (cadr remaining))))))
182
(global-set-key [?\221 ?\C-i] 'back-to-emacs)
183
(global-set-key [?\221 ?\C-s] 'search-ecl)
184
(global-set-key [?\221 ?\C-n] 'search-next-ecl)
185
(global-set-key [?\221 ?\C-m] 'next-ecl)
186
(global-set-key [?\221 ?\C-p] 'ecl-load-symbols)
188
(global-set-key [?\M-p ?\C-i] 'back-to-emacs)
189
(global-set-key [?\M-p ?\C-s] 'search-ecl)
190
(global-set-key [?\M-p ?\C-n] 'search-next-ecl)
191
(global-set-key [?\M-p ?\C-m] 'next-ecl)
192
(global-set-key [?\M-p ?\C-p] 'ecl-load-symbols)
194
(setq auto-mode-alist (acons "\\.d\\'" 'c-mode auto-mode-alist))
198
(set-buffer "emacs.el")
199
(concat (subseq (buffer-file-name (current-buffer)) 0 -13) x))
318
"clos/conditions.lsp"
348
"clx/attributes.lisp"
372
(mapcar 'find-file ecl-files)
376
(mapcar '(lambda (x) (let ((a (find-buffer-visiting x)))
377
(and a (switch-to-buffer a)
378
(revert-buffer t t))))