annotate lisp/ilisp/ilisp-cpat.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents 376386a54a3c
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-cpat.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 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Compatability between GNU emacs 18, 19, and Lucid emacs 19.
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 (defconst ilisp-emacs-version-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (cond ((string-match "Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (if (string-match "^19.[0-7][^0-9]" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 'lucid-19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ((string-match "^19" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (t 'gnu-18))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "What version of emacs we are running.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; Hook stuff--this should really be a part of emacs-lisp anyway
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (defun ilisp-member (elt list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (let ((result nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (cond ((equal elt (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (setq result list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (setq list (cdr list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defun ilisp-add-hook (hook function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 "Arguments are HOOK and FUNCTION. Add FUNCTION to HOOK's list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 FUNCTION is not added if it's already on the list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (set hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (if (boundp hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (let ((value (symbol-value hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (if (and value (or (not (consp value)) (eq (car value) 'lambda)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (setq value (cons value nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (if (not (ilisp-member function value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (setq value (append value (list function))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (list function))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (if (not (fboundp 'add-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (fset 'add-hook 'ilisp-add-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; 'ilisp-where-is' has been moved (and corrected) to ilisp-key.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;;; COMINT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;;; GNU, Lucid and 18 use different versions of comint with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;;; incompatible interface variables and functions. Hooray.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;; Some very old COMINT versions are missing these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (if (not (boundp 'comint-input-chunk-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq comint-input-chunk-size 512))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (if (not (boundp 'comint-ptyp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (setq comint-ptyp t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun ilisp-get-input-ring ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "Use instead of get-input-ring coming-input-ring or input-ring."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (cond ((eq ilisp-emacs-version-id 'lucid-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (get-input-ring))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ((or (eq ilisp-emacs-version-id 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (eq ilisp-emacs-version-id 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 comint-input-ring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (t input-ring)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defun ilisp-ring-insert (ring input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (if (eq ilisp-emacs-version-id 'lucid-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (ring-insert-new ring input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (ring-insert ring input)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun ilisp-temp-buffer-show-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (if (eq ilisp-emacs-version-id 'gnu-18)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 temp-buffer-show-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 temp-buffer-show-function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (defun ilisp-input-ring-index ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (if (or (eq ilisp-emacs-version-id 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (eq ilisp-emacs-version-id 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 comint-input-ring-index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 input-ring-index))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defun set-ilisp-input-ring-index (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (if (or (eq ilisp-emacs-version-id 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (eq ilisp-emacs-version-id 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (setq comint-input-ring-index n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (setq input-ring-index n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defun ilisp-input-ring-size ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (if (or (eq ilisp-emacs-version-id 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (eq ilisp-emacs-version-id 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 comint-input-ring-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 input-ring-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (defun set-ilisp-input-ring-size (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (if (or (eq ilisp-emacs-version-id 'gnu-19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (eq ilisp-emacs-version-id 'lucid-19-new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (setq comint-input-ring-size n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (setq input-ring-size n)))