annotate lisp/tl/emu-xemacs.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 360340f9fd5f
children cca96a509cfe
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.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
4 ;; Copyright (C) 1995,1996,1997 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:
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
8 ;; $Id: emu-xemacs.el,v 1.3 1997/03/16 03:05:44 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
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
11 ;; This file is part of XEmacs.
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
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
30 ;;; @ face
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
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
46 ;;; @ overlay
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
47 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 (defalias 'tl:make-overlay 'make-extent)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (defalias 'tl:overlay-put 'set-extent-property)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (defalias 'tl:overlay-buffer 'extent-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (defun tl:move-overlay (extent start end &optional buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (set-extent-endpoints extent start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 ;;; @@ visible/invisible
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 (defmacro enable-invisible ())
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (defmacro end-of-invisible ())
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (defun invisible-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (eq (following-char) ?\n)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (setq start (1+ start))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (put-text-property start end 'invisible t)
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 (defun visible-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (put-text-property start end 'invisible nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 )
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-p (pos)
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 pos)
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 pos (1+ pos))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (get-text-property pos 'invisible)
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 next-visible-point (pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (goto-char pos)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (eq (following-char) ?\n)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (setq pos (1+ pos))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (or (next-single-property-change pos 'invisible)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 ;;; @ mouse
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 (defvar mouse-button-1 'button1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 (defvar mouse-button-2 'button2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 (defvar mouse-button-3 'button3)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 ;;; @ dired
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (or (fboundp 'dired-other-frame)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (defun dired-other-frame (dirname &optional switches)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 "\"Edit\" directory DIRNAME. Like `dired' but makes a new frame."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (interactive (dired-read-dir-and-switches "in other frame "))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (switch-to-buffer-other-frame (dired-noselect dirname switches))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 ;;; @ string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (defmacro char-list-to-string (char-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 "Convert list of character CHAR-LIST to string. [emu-xemacs.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 `(mapconcat #'char-to-string ,char-list ""))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
130 ;;; @@ to avoid bug of XEmacs 19.14
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
131 ;;;
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
132
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
133 (or (string-match "^../"
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
134 (file-relative-name "/usr/local/share" "/usr/local/lib"))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
135 ;; This function was imported from Emacs 19.33.
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
136 (defun file-relative-name (filename &optional directory)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
137 "Convert FILENAME to be relative to DIRECTORY
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
138 (default: default-directory). [emu-xemacs.el]"
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
139 (setq filename (expand-file-name filename)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
140 directory (file-name-as-directory
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
141 (expand-file-name
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
142 (or directory default-directory))))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
143 (let ((ancestor ""))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
144 (while (not (string-match (concat "^" (regexp-quote directory))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
145 filename))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
146 (setq directory (file-name-directory (substring directory 0 -1))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
147 ancestor (concat "../" ancestor)))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
148 (concat ancestor (substring filename (match-end 0)))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
149 ))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
150 )
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
151
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
152
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (provide 'emu-xemacs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 ;;; emu-xemacs.el ends here