comparison lisp/ilisp/ilisp-cpat.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
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-cpat.el --
4
5 ;;; This file is part of ILISP.
6 ;;; Version: 5.7
7 ;;;
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
9 ;;; 1993, 1994 Ivan Vasquez
10 ;;; 1994, 1995 Marco Antoniotti and Rick Busdiecker
11 ;;;
12 ;;; Other authors' names for which this Copyright notice also holds
13 ;;; may appear later in this file.
14 ;;;
15 ;;; Send mail to 'ilisp-request@lehman.com' to be included in the
16 ;;; ILISP mailing list. 'ilisp@lehman.com' is the general ILISP
17 ;;; mailing list were bugs and improvements are discussed.
18 ;;;
19 ;;; ILISP is freely redistributable under the terms found in the file
20 ;;; COPYING.
21
22
23
24 ;;;
25 ;;;
26 ;;; Compatability between GNU emacs 18, 19, and Lucid emacs 19.
27 ;;;
28 ;;;
29 (defconst ilisp-emacs-version-id
30 (cond ((string-match "Lucid" emacs-version)
31 (if (string-match "^19.[0-7][^0-9]" emacs-version)
32 'lucid-19
33 'lucid-19-new))
34 ((string-match "^19" emacs-version)
35 'gnu-19)
36 (t 'gnu-18))
37 "What version of emacs we are running.")
38
39
40 ;; Hook stuff--this should really be a part of emacs-lisp anyway
41
42 (defun ilisp-member (elt list)
43 (let ((result nil))
44 (while list
45 (cond ((equal elt (car list))
46 (setq result list
47 list nil))
48 (t
49 (setq list (cdr list)))))
50 result))
51
52
53 (defun ilisp-add-hook (hook function)
54 "Arguments are HOOK and FUNCTION. Add FUNCTION to HOOK's list.
55 FUNCTION is not added if it's already on the list."
56 (set hook
57 (if (boundp hook)
58 (let ((value (symbol-value hook)))
59 (if (and value (or (not (consp value)) (eq (car value) 'lambda)))
60 (setq value (cons value nil)))
61 (if (not (ilisp-member function value))
62 (setq value (append value (list function))))
63 value)
64 (list function))))
65
66 (if (not (fboundp 'add-hook))
67 (fset 'add-hook 'ilisp-add-hook))
68
69
70 ;;; 'ilisp-where-is' has been moved (and corrected) to ilisp-key.el.
71
72 ;;;
73 ;;; COMINT
74 ;;;
75 ;;; GNU, Lucid and 18 use different versions of comint with
76 ;;; incompatible interface variables and functions. Hooray.
77 ;;;
78
79 ;; Some very old COMINT versions are missing these.
80 (if (not (boundp 'comint-input-chunk-size))
81 (setq comint-input-chunk-size 512))
82 (if (not (boundp 'comint-ptyp))
83 (setq comint-ptyp t))
84
85
86 (defun ilisp-get-input-ring ()
87 "Use instead of get-input-ring coming-input-ring or input-ring."
88 (cond ((eq ilisp-emacs-version-id 'lucid-19)
89 (get-input-ring))
90 ((or (eq ilisp-emacs-version-id 'gnu-19)
91 (eq ilisp-emacs-version-id 'lucid-19-new))
92 comint-input-ring)
93 (t input-ring)))
94
95 (defun ilisp-ring-insert (ring input)
96 (if (eq ilisp-emacs-version-id 'lucid-19)
97 (ring-insert-new ring input)
98 (ring-insert ring input)))
99
100 (defun ilisp-temp-buffer-show-function ()
101 (if (eq ilisp-emacs-version-id 'gnu-18)
102 temp-buffer-show-hook
103 temp-buffer-show-function))
104
105 (defun ilisp-input-ring-index ()
106 (if (or (eq ilisp-emacs-version-id 'gnu-19)
107 (eq ilisp-emacs-version-id 'lucid-19-new))
108 comint-input-ring-index
109 input-ring-index))
110
111 (defun set-ilisp-input-ring-index (n)
112 (if (or (eq ilisp-emacs-version-id 'gnu-19)
113 (eq ilisp-emacs-version-id 'lucid-19-new))
114 (setq comint-input-ring-index n)
115 (setq input-ring-index n)))
116
117 (defun ilisp-input-ring-size ()
118 (if (or (eq ilisp-emacs-version-id 'gnu-19)
119 (eq ilisp-emacs-version-id 'lucid-19-new))
120 comint-input-ring-size
121 input-ring-size))
122
123 (defun set-ilisp-input-ring-size (n)
124 (if (or (eq ilisp-emacs-version-id 'gnu-19)
125 (eq ilisp-emacs-version-id 'lucid-19-new))
126 (setq comint-input-ring-size n)
127 (setq input-ring-size n)))