annotate site-lisp/emu-xemacs.el @ 6:27bc7f280385 r19-15b4

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