annotate lisp/ilisp/ilisp-cmt.el @ 49:b46643e427ac

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