annotate lisp/tl/emu-xemacs.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 54cc21c15cbb
children fe104dbd9147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1 ;;; emu-xemacs.el --- emu API implementation for XEmacs
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
4 ;; Copyright (C) 1995,1996 MORIOKA Tomohiko
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Version:
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 74
diff changeset
8 ;; $Id: emu-xemacs.el,v 1.2 1997/03/08 23:26:56 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; Keywords: emulation, compatibility, XEmacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
11 ;; This file is part of emu.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the Free
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
25 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
26 ;; 02111-1307, USA.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
30 ;;; @ text property
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 (or (fboundp 'face-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (defalias 'face-list 'list-faces)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (or (memq 'underline (face-list))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (and (fboundp 'make-face)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (make-face 'underline)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 (or (face-differs-from-default-p 'underline)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (set-face-underline-p 'underline t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
45 (or (fboundp 'tl:set-text-properties)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
46 (defun tl:set-text-properties (start end props &optional buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
47 (if (or (null buffer) (bufferp buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
48 (if props
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
49 (while props
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
50 (put-text-property
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
51 start end (car props) (nth 1 props) buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
52 (setq props (nthcdr 2 props)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
53 (remove-text-properties start end ())
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
54 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
55 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 74
diff changeset
57 (defun tl:add-text-properties (start end properties &optional object)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
58 (add-text-properties start end
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
59 (append properties (list 'highlight t))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 74
diff changeset
60 object)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
61 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (defalias 'tl:make-overlay 'make-extent)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 (defalias 'tl:overlay-put 'set-extent-property)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (defalias 'tl:overlay-buffer 'extent-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defun tl:move-overlay (extent start end &optional buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (set-extent-endpoints extent start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 ;;; @@ visible/invisible
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (defmacro enable-invisible ())
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (defmacro end-of-invisible ())
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (defun invisible-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (eq (following-char) ?\n)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (setq start (1+ start))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (put-text-property start end 'invisible t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 (defun visible-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (put-text-property start end 'invisible nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (defun invisible-p (pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (goto-char pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (eq (following-char) ?\n)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (setq pos (1+ pos))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (get-text-property pos 'invisible)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (defun next-visible-point (pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 (goto-char pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 (eq (following-char) ?\n)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (setq pos (1+ pos))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (or (next-single-property-change pos 'invisible)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 ;;; @ mouse
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (defvar mouse-button-1 'button1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (defvar mouse-button-2 'button2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (defvar mouse-button-3 'button3)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 ;;; @ dired
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (or (fboundp 'dired-other-frame)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (defun dired-other-frame (dirname &optional switches)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 "\"Edit\" directory DIRNAME. Like `dired' but makes a new frame."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (interactive (dired-read-dir-and-switches "in other frame "))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (switch-to-buffer-other-frame (dired-noselect dirname switches))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 ;;; @ string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 (defmacro char-list-to-string (char-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 "Convert list of character CHAR-LIST to string. [emu-xemacs.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 `(mapconcat #'char-to-string ,char-list ""))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
144 ;;; @@ to avoid bug of XEmacs 19.14
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
145 ;;;
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
146
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
147 (or (string-match "^../"
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
148 (file-relative-name "/usr/local/share" "/usr/local/lib"))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
149 ;; This function was imported from Emacs 19.33.
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
150 (defun file-relative-name (filename &optional directory)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
151 "Convert FILENAME to be relative to DIRECTORY
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
152 (default: default-directory). [emu-xemacs.el]"
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
153 (setq filename (expand-file-name filename)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
154 directory (file-name-as-directory
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
155 (expand-file-name
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
156 (or directory default-directory))))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
157 (let ((ancestor ""))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
158 (while (not (string-match (concat "^" (regexp-quote directory))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
159 filename))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
160 (setq directory (file-name-directory (substring directory 0 -1))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
161 ancestor (concat "../" ancestor)))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
162 (concat ancestor (substring filename (match-end 0)))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
163 ))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
164 )
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
165
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
166
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (provide 'emu-xemacs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 ;;; emu-xemacs.el ends here