Thread View: fa.editor-p
1 messages
1 total messages
Started by utzoodecvaxharponpoivnpoisucbvax...
Wed, 25 Aug 1982 03:19
Re: Extension languages
Author: utzoodecvaxharponpoivnpoisucbvax...
Date: Wed, 25 Aug 1982 03:19
Date: Wed, 25 Aug 1982 03:19
72 lines
2965 bytes
2965 bytes
>From Margolin.Multics@MIT-MULTICS Wed Aug 25 02:57:45 1982
Remailed-date: 25 Aug 1982 0014-PDT
Remailed-from: J.Q. Johnson <Admin.JQJ at SU-SCORE>
Remailed-to: Editor People: ;
While you are comparing Teco and Pascal, how about considering a Lisp
version? Remember, Lisp interpreters are already known technology,
and much easier to implement than interpreters of strongly-typed
languages like Pascal. The Pascal version was very nice looking, but
can you read that into a buffer, make a minor modification, type
esc-^C, and then be executing the new version right in the same Emacs
invocation? Well, here's our code (Multics Emacs):
;;;
;;; Query replace by Carl Hoffman
;;;
(defcom query-replace
&arguments ((old &default
&eval (get-search-string "Query replace old string: "))
(new &prompt "Query replace new string: " NL))
(assert-minor-mode '|query replace|)
(if (not (forward-search old))
(minibuffer-print "No occurrences of old string found.")
else
(query-replace-execute old new)
(minibuffer-print "Done."))
(negate-minor-mode '|query replace|))
; This function does all of the work. When it is invoked, the point
; is to the right of the first occurrence of the old string.
(defun query-replace-execute (old new)
(catch (do-forever
(redisplay)
(query-replace-dispatch old new (get-char))
(if (not (forward-search old)) (stop-doing)))
done))
(defun query-replace-dispatch (old new response)
(do-forever
(cond ((= response #/,)
(query-replace-swap-strings old new)
(redisplay)
(stop-doing))
((= response #/ )
(query-replace-swap-strings old new)
(stop-doing)) ;don't redisplay 10/15/80
((or (= response #^M) ;return = 15
(= response 177)) ;rubout = 177
(stop-doing))
((= response #/!) ;! is replace to end
(query-replace-swap-strings old new)
(do-forever
(if (forward-search old) (query-replace-swap-strings old new)
else (throw t done))))
((= response #/.)
(query-replace-swap-strings old new)
(throw t done))
((or (= response #^G) (= response 33)) ;altmode
(throw t done))
((= response #^J)) ;newline = 12
(t (display-error-noabort "Unknown query replace response.")
(redisplay)))
(setq response (get-char))))
(defun query-replace-swap-strings (old new)
(with-mark m
(reverse-search old)
(without-saving (wipe-point-mark m))
(insert-string new)))
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads