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