Annotation of 43BSD/contrib/emacs/lisp/ledit.el, revision 1.1

1.1     ! root        1: ;; Emacs side of ledit interface
        !             2: ;; Copyright (C) 1985 Richard M. Stallman.
        !             3: 
        !             4: ;; This file is part of GNU Emacs.
        !             5: 
        !             6: ;; GNU Emacs is distributed in the hope that it will be useful,
        !             7: ;; but WITHOUT ANY WARRANTY.  No author or distributor
        !             8: ;; accepts responsibility to anyone for the consequences of using it
        !             9: ;; or for whether it serves any particular purpose or works at all,
        !            10: ;; unless he says so in writing.  Refer to the GNU Emacs General Public
        !            11: ;; License for full details.
        !            12: 
        !            13: ;; Everyone is granted permission to copy, modify and redistribute
        !            14: ;; GNU Emacs, but only under the conditions described in the
        !            15: ;; GNU Emacs General Public License.   A copy of this license is
        !            16: ;; supposed to have been given to you along with GNU Emacs so you
        !            17: ;; can know your rights and responsibilities.  It should be in a
        !            18: ;; file named COPYING.  Among other things, the copyright notice
        !            19: ;; and this notice must be preserved on all copies.
        !            20: 
        !            21: 
        !            22: ;;; To do:
        !            23: ;;; o lisp -> emacs side of things (grind-definition and find-definition)
        !            24: 
        !            25: (defvar ledit-mode-map nil)
        !            26: 
        !            27: (defconst ledit-zap-file (concat "/tmp/" (getenv "USER") ".l1")
        !            28:   "File name for data sent to Lisp by Ledit.")
        !            29: (defconst ledit-read-file (concat "/tmp/" (getenv "USER") ".l2")
        !            30:   "File name for data sent to Ledit by Lisp.")
        !            31: (defconst ledit-compile-file 
        !            32:   (concat "/tmp/" (getenv "USER") ".l4")
        !            33:   "File name for data sent to Lisp compiler by Ledit.")
        !            34: (defconst ledit-buffer "*LEDIT*"
        !            35:   "Name of buffer in which Ledit accumulates data to send to Lisp.")
        !            36: ;These are now in loaddefs.el
        !            37: ;(defconst ledit-save-files t
        !            38: ;  "*Non-nil means Ledit should save files before transferring to Lisp.")
        !            39: ;(defconst ledit-go-to-lisp-string "%?lisp"
        !            40: ;  "*Shell commands to execute to resume Lisp job.")
        !            41: ;(defconst ledit-go-to-liszt-string "%?liszt"
        !            42: ;  "*Shell commands to execute to resume Lisp compiler job.")
        !            43: 
        !            44: (defun ledit-save-defun ()
        !            45:   "Save the current defun in the ledit buffer"
        !            46:   (interactive)
        !            47:   (save-excursion
        !            48:    (end-of-defun)
        !            49:    (let ((end (point)))
        !            50:      (beginning-of-defun)
        !            51:      (append-to-buffer ledit-buffer (point) end))
        !            52:    (message "Current defun saved for Lisp")))
        !            53: 
        !            54: (defun ledit-save-region (beg end)
        !            55:   "Save the current region in the ledit buffer"
        !            56:   (interactive "r")
        !            57:   (append-to-buffer ledit-buffer beg end)
        !            58:   (message "Region saved for Lisp"))
        !            59: 
        !            60: (defun ledit-zap-defun-to-lisp ()
        !            61:   "Carry the current defun to lisp"
        !            62:   (interactive)
        !            63:   (ledit-save-defun)
        !            64:   (ledit-go-to-lisp))
        !            65: 
        !            66: (defun ledit-zap-defun-to-liszt ()
        !            67:   "Carry the current defun to liszt"
        !            68:   (interactive)
        !            69:   (ledit-save-defun)
        !            70:   (ledit-go-to-liszt))
        !            71: 
        !            72: (defun ledit-zap-region-to-lisp (beg end)
        !            73:   "Carry the current region to lisp"
        !            74:   (interactive "r")
        !            75:   (ledit-save-region beg end)
        !            76:   (ledit-go-to-lisp))
        !            77: 
        !            78: (defun ledit-go-to-lisp ()
        !            79:   "Suspend Emacs and restart a waiting Lisp job."
        !            80:   (interactive)
        !            81:   (if ledit-save-files
        !            82:       (save-some-buffers))
        !            83:   (if (get-buffer ledit-buffer)
        !            84:       (save-excursion
        !            85:        (set-buffer ledit-buffer)
        !            86:        (goto-char (point-min))
        !            87:        (write-region (point-min) (point-max) ledit-zap-file)
        !            88:        (erase-buffer)))
        !            89:   (suspend-emacs ledit-go-to-lisp-string)
        !            90:   (load ledit-read-file t t))
        !            91: 
        !            92: (defun ledit-go-to-liszt ()
        !            93:   "Suspend Emacs and restart a waiting Liszt job."
        !            94:   (interactive)
        !            95:   (if ledit-save-files
        !            96:       (save-some-buffers))
        !            97:   (if (get-buffer ledit-buffer)
        !            98:       (save-excursion
        !            99:        (set-buffer ledit-buffer)
        !           100:        (goto-char (point-min))
        !           101:        (insert "(declare (macros t))\n")
        !           102:        (write-region (point-min) (point-max) ledit-compile-file)
        !           103:        (erase-buffer)))
        !           104:   (suspend-emacs ledit-go-to-liszt-string)
        !           105:   (load ledit-read-file t t))
        !           106: 
        !           107: (defun ledit-setup ()
        !           108:   "Set up key bindings for the Lisp / Emacs interface"
        !           109:   (if (not ledit-mode-map)
        !           110:       (progn (setq ledit-mode-map (make-sparse-keymap))
        !           111:             (lisp-mode-commands ledit-mode-map)))
        !           112:   (define-key ledit-mode-map "\e\^d" 'ledit-save-defun)
        !           113:   (define-key ledit-mode-map "\e\^r" 'ledit-save-region)
        !           114:   (define-key ledit-mode-map "\^xz" 'ledit-go-to-lisp)
        !           115:   (define-key ledit-mode-map "\e\^c" 'ledit-go-to-liszt))
        !           116: 
        !           117: (ledit-setup)
        !           118: 
        !           119: (defun ledit-mode ()
        !           120:   "Major mode for editing text and stuffing it to a Lisp job.
        !           121: Like Lisp mode, plus these special commands:
        !           122:   M-C-d        -- record defun at or after point
        !           123:           for later transmission to Lisp job.
        !           124:   M-C-r -- record region for later transmission to Lisp job.
        !           125:   C-x z -- transfer to Lisp job and transmit saved text.
        !           126:   M-C-c -- transfer to Liszt (Lisp compiler) job
        !           127:           and transmit saved text.
        !           128: \\{ledit-mode-map}
        !           129: To make Lisp mode automatically change to Ledit mode,
        !           130: do (setq lisp-mode-hook 'ledit-from-lisp-mode)"
        !           131:   (interactive)
        !           132:   (lisp-mode)
        !           133:   (ledit-from-lisp-mode))
        !           134: 
        !           135: (defun ledit-from-lisp-mode ()
        !           136:   (use-local-map ledit-mode-map)
        !           137:   (setq mode-name "Ledit")
        !           138:   (setq major-mode 'ledit-mode)
        !           139:   (run-hooks 'ledit-mode-hook))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.