diff options
| author | Dave Love | 1999-10-08 15:56:42 +0000 |
|---|---|---|
| committer | Dave Love | 1999-10-08 15:56:42 +0000 |
| commit | 711f235227fff96f7fa9fe2bdd8fb70d2ecaa3ad (patch) | |
| tree | 3490873401dd6b988c4d6f75009fd1886e3fb1be /etc | |
| parent | 059c2e18d12aa6cb1978a2e49dfd55a9ca205c3c (diff) | |
| download | emacs-711f235227fff96f7fa9fe2bdd8fb70d2ecaa3ad.tar.gz emacs-711f235227fff96f7fa9fe2bdd8fb70d2ecaa3ad.zip | |
#
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/LEDIT | 77 | ||||
| -rw-r--r-- | etc/ledit.l | 150 |
2 files changed, 227 insertions, 0 deletions
diff --git a/etc/LEDIT b/etc/LEDIT new file mode 100644 index 00000000000..ff274ce46bf --- /dev/null +++ b/etc/LEDIT | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | Date: 17 Apr 85 15:45:42 EST (Wed) | ||
| 2 | From: Martin David Connor <mdc@MIT-HTVAX.ARPA> | ||
| 3 | |||
| 4 | Date: Sat, 13 Apr 85 16:28:15 est | ||
| 5 | From: Richard M. Stallman <rms@mit-prep> | ||
| 6 | |||
| 7 | Can you help this person? Also, can you give me the rest of ledit | ||
| 8 | to distribute, plus some info on how to use it? | ||
| 9 | |||
| 10 | I have put the files "ledit.l" and "leditcfns.c" on prep:~mdc. | ||
| 11 | Much to my disgust ledit.l relied on some bogus little package of | ||
| 12 | functions on HT, so I had to massage it a bit. | ||
| 13 | |||
| 14 | To get it to work, one must: | ||
| 15 | |||
| 16 | - Compile leditcfns.c with something like: | ||
| 17 | |||
| 18 | cc leditcfns.c | ||
| 19 | |||
| 20 | - Edit ledit.l, changing the line beginning "(cfasl" to | ||
| 21 | have the right pathname for the cfns file you compiled in | ||
| 22 | the last step. | ||
| 23 | |||
| 24 | - Compile ledit.l with: | ||
| 25 | |||
| 26 | liszt ledit.l | ||
| 27 | |||
| 28 | Then put the following lines in your .lisprc file: | ||
| 29 | |||
| 30 | ;load in functions for emacs interface | ||
| 31 | (load "//src//mdc//ledit//ledit") ; Location of Ledit library | ||
| 32 | (set-proc-str "%gnumacs") ; Name of editor | ||
| 33 | |||
| 34 | Then you can use ^E <RETURN> to get from LISP back to gnumacs. | ||
| 35 | |||
| 36 | Here is the part of my .emacs file that pertains to ledit. | ||
| 37 | |||
| 38 | ;;; Set up ledit mode | ||
| 39 | (setq ledit-go-to-lisp-string "%lisp") | ||
| 40 | (setq lisp-mode-hook 'ledit-from-lisp-mode) | ||
| 41 | |||
| 42 | Date: Sat, 13 Apr 85 11:26:32 cst | ||
| 43 | From: neves@wisc-ai.arpa (David Neves) | ||
| 44 | |||
| 45 | This is a documentation question. | ||
| 46 | I cannot figure out how to use Ledit. I suspect I need some | ||
| 47 | function on the Franz Lisp end of things to go to Emacs and read in | ||
| 48 | the temporary file. Is this true? Is the Lisp job started within | ||
| 49 | Emacs or outside of emacs? I'm just plain confused. Perhaps a couple | ||
| 50 | of words from someone in the know would help. | ||
| 51 | |||
| 52 | A related question. I have been using a shell buffer when interacting | ||
| 53 | with Lisp (ie. put a definition in the kill buffer and then yank it | ||
| 54 | into the shell buffer to redefine it). This is nice but tends to fill | ||
| 55 | up the shell buffer with lots of code (I'd rather keep calls to functions | ||
| 56 | in the shell and not the functions themselves). | ||
| 57 | My question: Is using the shell buffer "better" than ledit? Am I using | ||
| 58 | it in the best way (i.e. copying definitions from an edit buffer to the | ||
| 59 | shell buffer)? -Thanks, David Neves | ||
| 60 | |||
| 61 | I have found that ledit works well for doing programming development | ||
| 62 | when you are changing lots of little pieces of a file and don't wish | ||
| 63 | to recompile the whole file. Of course M-X Compile is very nice for | ||
| 64 | calling up a liszt on a buffer and watching it in the another window. | ||
| 65 | Of course the interface of something like NIL is even better because | ||
| 66 | you can compile your function directly into your lisp. But since NIL | ||
| 67 | doesn't run under Unix, this is probably the next best thing. | ||
| 68 | |||
| 69 | I have tried the 2 window method (shell in lower window, lisp code in | ||
| 70 | upper), and have found it a little awkward. It does have certain | ||
| 71 | advantages, but most of the time, I get be fine using M-C-D to save a | ||
| 72 | defun for lisp, and C-X Z to jump back to LISP. C-E RETURN from lisp | ||
| 73 | is also mnemonic for getting back to gnumacs. | ||
| 74 | |||
| 75 | I hope this helps somewhat. | ||
| 76 | |||
| 77 | |||
diff --git a/etc/ledit.l b/etc/ledit.l new file mode 100644 index 00000000000..a66d1c321ea --- /dev/null +++ b/etc/ledit.l | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | ;;; -*- Mode: lisp -*- | ||
| 2 | |||
| 3 | ; load in the c functions | ||
| 4 | |||
| 5 | (removeaddress '_signal) | ||
| 6 | (removeaddress '_switch_to_proc) | ||
| 7 | (removeaddress '_set_proc_str) | ||
| 8 | |||
| 9 | (cfasl "/src/mdc/ledit/leditcfns.o" '_switch_to_proc 'emacs) | ||
| 10 | |||
| 11 | (getaddress '_set_proc_str 'set_proc_str) | ||
| 12 | |||
| 13 | (declare (special *ledit-infile* ; emacs->lisp tempfile | ||
| 14 | *ledit-outfile* ; lisp->emacs tempfile | ||
| 15 | *ledit-ppfile* ; pp->emacs tempfile | ||
| 16 | *ledit-lisztfile* ; compiler input | ||
| 17 | *ledit-objfile* ; compiler output | ||
| 18 | *ledit-initialized*) ; flag | ||
| 19 | ) | ||
| 20 | |||
| 21 | (setq *ledit-initialized* nil) | ||
| 22 | |||
| 23 | ;;; INIT-LEDIT | ||
| 24 | |||
| 25 | (defun init-ledit () | ||
| 26 | (let ((user (getenv '|USER|))) ;USER must be uppercase | ||
| 27 | (setq | ||
| 28 | *ledit-outfile* (concat "/tmp/" user ".l2") ; lisp -> emacs | ||
| 29 | *ledit-infile* (concat "/tmp/" user ".l1") ; emacs -> lisp | ||
| 30 | *ledit-ppfile* (concat "/tmp/" user ".l3") ; pp output to emacs. | ||
| 31 | *ledit-lisztfile* (concat "/tmp/" user ".l4") | ||
| 32 | *ledit-objfile* (concat "/tmp/" user ".o") | ||
| 33 | *ledit-initialized* t))) | ||
| 34 | |||
| 35 | ;;; LEDIT | ||
| 36 | ; if 1 arg, arg is taken as a tag name to pass to emacs. | ||
| 37 | ; if 2 args, second arg is a keyword. If 2nd arg is pp, | ||
| 38 | ; pp is applied to first arg, and result is sent to emacs | ||
| 39 | ; to put in a buffer called LEDIT (which is first erased.) | ||
| 40 | |||
| 41 | (defun ledit fexpr (args) | ||
| 42 | (apply #'ledit* args)) | ||
| 43 | |||
| 44 | ;;; LEDIT* | ||
| 45 | |||
| 46 | (defun ledit* n | ||
| 47 | (if (not *ledit-initialized*) (init-ledit)) | ||
| 48 | (ledit-output (listify n)) | ||
| 49 | (syscall 10. *ledit-infile*) ; syscall 10 is "delete" | ||
| 50 | (syscall 10. *ledit-lisztfile*) | ||
| 51 | (emacs) | ||
| 52 | (ledit-input) | ||
| 53 | (syscall 10. *ledit-outfile*) | ||
| 54 | (syscall 10. *ledit-ppfile*) | ||
| 55 | t) | ||
| 56 | |||
| 57 | ;;; LEDIT-OUTPUT | ||
| 58 | ;;; Egad, what a mess! Doesn't work for XEMACS yet. | ||
| 59 | ;;; Here's an example from Mocklisp: | ||
| 60 | ;;; -> (defun bar (nothing) (bar nothing)) | ||
| 61 | ;;; bar | ||
| 62 | ;;; -> (ledit bar) | ||
| 63 | ;;; should produce... | ||
| 64 | ;;; (progn) (progn tag (setq tag "bar") (&goto-tag)) | ||
| 65 | ;;; and | ||
| 66 | ;;; -> (ledit bar pp) | ||
| 67 | ;;; should stuff this to emacs... | ||
| 68 | ;;; (progn) (switch-to-buffer "LEDIT") (erase-buffer) | ||
| 69 | ;;; (insert-file "/tmp/walter.l3") (lisp-mode) | ||
| 70 | ;;; and this... | ||
| 71 | ;;; (def bar | ||
| 72 | ;;; (lambda (x) | ||
| 73 | ;;; (bar nothing))) | ||
| 74 | ;;; into *LEDIT* | ||
| 75 | |||
| 76 | (defun ledit-output (args) | ||
| 77 | (if args | ||
| 78 | (let ((ofile (outfile *ledit-outfile*))) | ||
| 79 | (format ofile "(progn)") ; this is necessary. | ||
| 80 | |||
| 81 | (cond ((null (cdr args)) ; no keyword -> arg is a tag. | ||
| 82 | (format ofile "(progn tag (setq tag \"~A\"~ | ||
| 83 | (&goto-tag))" | ||
| 84 | (car args))) | ||
| 85 | ((eq (cadr args) 'pp) ; pp-> pp first arg to emacs | ||
| 86 | (apply 'pp `((|F| ,*ledit-ppfile*) ,(car args))) | ||
| 87 | (format ofile "(switch-to-buffer \"LEDIT\")~ | ||
| 88 | (erase-buffer)") | ||
| 89 | (format ofile "(insert-file \"~A\")" | ||
| 90 | *ledit-ppfile*) | ||
| 91 | (format ofile "(lisp-mode)")) | ||
| 92 | |||
| 93 | (t (format t "~&~A -- unknown option~%" (cdr args)))) | ||
| 94 | (close ofile)))) | ||
| 95 | |||
| 96 | ;;; LISZT* | ||
| 97 | ;;; Need this guy to do compile-input. | ||
| 98 | ;;; Liszt returns 0 if all was well. | ||
| 99 | ;;; Note that in ordinary use the user will have to get used to looking | ||
| 100 | ;;; at "%Warning: ... Compiler declared *foo* special" messages, since | ||
| 101 | ;;; you don't usually want to hunt around in your file, zap in the the | ||
| 102 | ;;; declarations, then go back to what you were doing. | ||
| 103 | ;;; Fortunately this doesn't cause the compiler to bomb. | ||
| 104 | ;;; Some sleepless night I will think of a way to get around this. | ||
| 105 | |||
| 106 | (defun liszt* (&rest args) | ||
| 107 | (apply #'liszt args)) | ||
| 108 | |||
| 109 | ;;; LEDIT-INPUT | ||
| 110 | ;;; Although there are two cases here, in practice | ||
| 111 | ;;; it is never the case that there is both input to be | ||
| 112 | ;;; interpreted and input to be compiled. | ||
| 113 | |||
| 114 | (defun ledit-input () | ||
| 115 | (if (probef *ledit-lisztfile*) | ||
| 116 | (cond ((getd #'liszt) | ||
| 117 | (format t ";Compiling LEDIT:") | ||
| 118 | (and (zerop (liszt* *ledit-lisztfile* '-o *ledit-objfile*)) | ||
| 119 | (load *ledit-objfile*))) | ||
| 120 | (t (format t ";Can't compile LEDIT: No liszt.~%;Reading instead:") | ||
| 121 | (let ((ifile (infile *ledit-lisztfile*))) | ||
| 122 | (ledit-load ifile) | ||
| 123 | (close ifile))))) | ||
| 124 | |||
| 125 | (if (probef *ledit-infile*) | ||
| 126 | (let ((ifile (infile *ledit-infile*))) | ||
| 127 | (format t ";Reading from LEDIT:~%") | ||
| 128 | (ledit-load ifile) | ||
| 129 | (close ifile)))) | ||
| 130 | |||
| 131 | ;;; LEDIT-LOAD | ||
| 132 | ;;; A generally useful form of load | ||
| 133 | |||
| 134 | (defun ledit-load (ifile) | ||
| 135 | (let ((eof-form (list 'eof-form))) | ||
| 136 | (do ((form (read ifile eof-form) (read ifile eof-form))) | ||
| 137 | ((eq form eof-form)) | ||
| 138 | (format t "; ~A~%" (eval form))))) | ||
| 139 | |||
| 140 | (setsyntax #/ 'macro 'ledit) ; make ^E = (ledit)<return> | ||
| 141 | |||
| 142 | ;; more robust version of the c function set_proc_str. Does argument checking. | ||
| 143 | ;; set_proc_str sets the string that is stuffed to the tty after franz pauses | ||
| 144 | ;; and the csh wakes up. It is usually "%emacs" or "%vemacs" or "%?emacs" | ||
| 145 | (defun set-proc-str (arg) | ||
| 146 | (if (stringp arg) | ||
| 147 | (set_proc_str arg) | ||
| 148 | (if (symbolp arg) | ||
| 149 | (set_proc_str (get-pname arg)) | ||
| 150 | (error arg " is illegal argument to set-proc-str")))) | ||