annotate lisp/ilisp/ilisp-cmt.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children b82b59fe008d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; -*- Mode: Emacs-Lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; ilisp-cmt.el --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; This file is part of ILISP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; Version: 5.7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; 1993, 1994 Ivan Vasquez
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; 1994, 1995 Marco Antoniotti and Rick Busdiecker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; Other authors' names for which this Copyright notice also holds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; may appear later in this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; Send mail to 'ilisp-request@lehman.com' to be included in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; ILISP mailing list. 'ilisp@lehman.com' is the general ILISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; mailing list were bugs and improvements are discussed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; ILISP is freely redistributable under the terms found in the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; COPYING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; ILISP comint interface code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;%Process interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;;%%Comint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defun ilisp-get-old-input ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "Snarf the sexp starting at the nearest previous prompt, or NIL if none."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (let* ((begin (lisp-defun-begin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (pmark (process-mark (get-buffer-process (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (once (if (< (point) pmark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (save-excursion (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (done nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (while (and (not done) (< (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (skip-chars-forward " \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (if (and once (>= (point) once)) (setq done t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (error (setq end nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (if end (buffer-substring begin end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defun ilisp-input-filter (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 "Don't save anything matching ilisp-filter-regexp or less than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ilisp-filter-length long."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (and (not (string-match ilisp-filter-regexp str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (> (length str) ilisp-filter-length)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defun ilisp-error-filter (output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "Keep from OUTPUT only what matches ilisp-error-regexp or everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 if there is no match."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (if (string-match (ilisp-value 'ilisp-error-regexp) output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (substring output (match-beginning 0) (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 output))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defun newline-and-indent-lisp ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "If at the end of the buffer, send the string back to the process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 mark with no newline. Otherwise, insert a newline, then indent. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 an ilisp buffer the region is narrowed first. See newline-and-indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (interactive "*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (if ilisp-complete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (exit-minibuffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (let (input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if (and (= (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (memq major-mode ilisp-modes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq input (ilisp-get-old-input)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (let ((process (ilisp-process))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (comint-send-newline (not comint-send-newline)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (funcall comint-input-sender process input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (set-marker (process-mark process) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (if (memq major-mode ilisp-modes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (narrow-to-region (save-excursion (lisp-input-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (newline-and-indent))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87