Mercurial > emacs
annotate lisp/ledit.el @ 811:e694e0879463
*** empty log message ***
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Fri, 17 Jul 1992 08:15:29 +0000 |
parents | 4f28bd14272c |
children | 20674ae6bf52 |
rev | line source |
---|---|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
1 ;;; ledit.el --- Emacs side of ledit interface |
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
2 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
3 ;; Maintainer: FSF |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
4 ;; Last-Modified: 13 May 1991 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 ;; Keyord: languages |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
6 |
36 | 7 ;; Copyright (C) 1985 Free Software Foundation, Inc. |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
25 ;;; Code: |
36 | 26 |
27 ;;; To do: | |
28 ;;; o lisp -> emacs side of things (grind-definition and find-definition) | |
29 | |
30 (defvar ledit-mode-map nil) | |
31 | |
32 (defconst ledit-zap-file (concat "/tmp/" (user-login-name) ".l1") | |
33 "File name for data sent to Lisp by Ledit.") | |
34 (defconst ledit-read-file (concat "/tmp/" (user-login-name) ".l2") | |
35 "File name for data sent to Ledit by Lisp.") | |
36 (defconst ledit-compile-file | |
37 (concat "/tmp/" (user-login-name) ".l4") | |
38 "File name for data sent to Lisp compiler by Ledit.") | |
39 (defconst ledit-buffer "*LEDIT*" | |
40 "Name of buffer in which Ledit accumulates data to send to Lisp.") | |
256 | 41 |
269 | 42 ;;;###autoload |
43 (defconst ledit-save-files t "\ | |
44 *Non-nil means Ledit should save files before transferring to Lisp.") | |
45 ;;;###autoload | |
46 (defconst ledit-go-to-lisp-string "%?lisp" "\ | |
47 *Shell commands to execute to resume Lisp job.") | |
48 ;;;###autoload | |
49 (defconst ledit-go-to-liszt-string "%?liszt" "\ | |
50 *Shell commands to execute to resume Lisp compiler job.") | |
36 | 51 |
52 (defun ledit-save-defun () | |
53 "Save the current defun in the ledit buffer" | |
54 (interactive) | |
55 (save-excursion | |
56 (end-of-defun) | |
57 (let ((end (point))) | |
58 (beginning-of-defun) | |
59 (append-to-buffer ledit-buffer (point) end)) | |
60 (message "Current defun saved for Lisp"))) | |
61 | |
62 (defun ledit-save-region (beg end) | |
63 "Save the current region in the ledit buffer" | |
64 (interactive "r") | |
65 (append-to-buffer ledit-buffer beg end) | |
66 (message "Region saved for Lisp")) | |
67 | |
68 (defun ledit-zap-defun-to-lisp () | |
214 | 69 "Carry the current defun to Lisp." |
36 | 70 (interactive) |
71 (ledit-save-defun) | |
72 (ledit-go-to-lisp)) | |
73 | |
74 (defun ledit-zap-defun-to-liszt () | |
214 | 75 "Carry the current defun to liszt." |
36 | 76 (interactive) |
77 (ledit-save-defun) | |
78 (ledit-go-to-liszt)) | |
79 | |
80 (defun ledit-zap-region-to-lisp (beg end) | |
214 | 81 "Carry the current region to Lisp." |
36 | 82 (interactive "r") |
83 (ledit-save-region beg end) | |
84 (ledit-go-to-lisp)) | |
85 | |
86 (defun ledit-go-to-lisp () | |
87 "Suspend Emacs and restart a waiting Lisp job." | |
88 (interactive) | |
89 (if ledit-save-files | |
90 (save-some-buffers)) | |
91 (if (get-buffer ledit-buffer) | |
92 (save-excursion | |
93 (set-buffer ledit-buffer) | |
94 (goto-char (point-min)) | |
95 (write-region (point-min) (point-max) ledit-zap-file) | |
96 (erase-buffer))) | |
97 (suspend-emacs ledit-go-to-lisp-string) | |
98 (load ledit-read-file t t)) | |
99 | |
100 (defun ledit-go-to-liszt () | |
101 "Suspend Emacs and restart a waiting Liszt job." | |
102 (interactive) | |
103 (if ledit-save-files | |
104 (save-some-buffers)) | |
105 (if (get-buffer ledit-buffer) | |
106 (save-excursion | |
107 (set-buffer ledit-buffer) | |
108 (goto-char (point-min)) | |
109 (insert "(declare (macros t))\n") | |
110 (write-region (point-min) (point-max) ledit-compile-file) | |
111 (erase-buffer))) | |
112 (suspend-emacs ledit-go-to-liszt-string) | |
113 (load ledit-read-file t t)) | |
114 | |
115 (defun ledit-setup () | |
214 | 116 "Set up key bindings for the Lisp/Emacs interface." |
36 | 117 (if (not ledit-mode-map) |
118 (progn (setq ledit-mode-map (make-sparse-keymap)) | |
119 (lisp-mode-commands ledit-mode-map))) | |
120 (define-key ledit-mode-map "\e\^d" 'ledit-save-defun) | |
121 (define-key ledit-mode-map "\e\^r" 'ledit-save-region) | |
122 (define-key ledit-mode-map "\^xz" 'ledit-go-to-lisp) | |
123 (define-key ledit-mode-map "\e\^c" 'ledit-go-to-liszt)) | |
124 | |
125 (ledit-setup) | |
126 | |
256 | 127 ;;;###autoload |
36 | 128 (defun ledit-mode () |
214 | 129 "\\<ledit-mode-map>Major mode for editing text and stuffing it to a Lisp job. |
36 | 130 Like Lisp mode, plus these special commands: |
214 | 131 \\[ledit-save-defun] -- record defun at or after point |
36 | 132 for later transmission to Lisp job. |
214 | 133 \\[ledit-save-region] -- record region for later transmission to Lisp job. |
134 \\[ledit-go-to-lisp] -- transfer to Lisp job and transmit saved text. | |
135 \\[ledit-go-to-liszt] -- transfer to Liszt (Lisp compiler) job | |
36 | 136 and transmit saved text. |
137 \\{ledit-mode-map} | |
138 To make Lisp mode automatically change to Ledit mode, | |
139 do (setq lisp-mode-hook 'ledit-from-lisp-mode)" | |
140 (interactive) | |
141 (lisp-mode) | |
142 (ledit-from-lisp-mode)) | |
143 | |
256 | 144 ;;;###autoload |
36 | 145 (defun ledit-from-lisp-mode () |
146 (use-local-map ledit-mode-map) | |
147 (setq mode-name "Ledit") | |
148 (setq major-mode 'ledit-mode) | |
149 (run-hooks 'ledit-mode-hook)) | |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
150 |
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
151 ;;; ledit.el ends here |