f71e462c325dac4ae2d4c490d9b4ebbbcfa3685c
[elisp/apel.git] / emu-xemacs.el
1 ;;;
2 ;;; emu-xemacs.el --- Emacs 19 emulation module for XEmacs
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Version:
9 ;;;     $Id: emu-xemacs.el,v 7.8 1996/05/26 02:13:21 morioka Exp $
10 ;;; Keywords: emulation, compatibility, XEmacs
11 ;;;
12 ;;; This file is part of tl (Tiny Library).
13 ;;;
14 ;;; This program is free software; you can redistribute it and/or
15 ;;; modify it under the terms of the GNU General Public License as
16 ;;; published by the Free Software Foundation; either version 2, or
17 ;;; (at your option) any later version.
18 ;;;
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 ;;; General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with This program.  If not, write to the Free Software
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, 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 (defun invisible-region (start end)
76   (if (save-excursion
77         (goto-char start)
78         (eq (following-char) ?\n)
79         )
80       (setq start (1+ start))
81     )
82   (put-text-property start end 'invisible t)
83   )
84
85 (defun visible-region (start end)
86   (put-text-property start end 'invisible nil)
87   )
88
89 (defun invisible-p (pos)
90   (if (save-excursion
91         (goto-char pos)
92         (eq (following-char) ?\n)
93         )
94       (setq pos (1+ pos))
95     )
96   (get-text-property pos 'invisible)
97   )
98
99 (defun next-visible-point (pos)
100   (save-excursion
101     (if (save-excursion
102           (goto-char pos)
103           (eq (following-char) ?\n)
104           )
105         (setq pos (1+ pos))
106       )
107     (next-single-property-change pos 'invisible)
108     ))
109
110
111 ;;; @ mouse
112 ;;;
113
114 (defvar mouse-button-1 'button1)
115 (defvar mouse-button-2 'button2)
116 (defvar mouse-button-3 'button3)
117
118
119 ;;; @ dired
120 ;;;
121
122 (or (fboundp 'dired-other-frame)
123     (defun dired-other-frame (dirname &optional switches)
124       "\"Edit\" directory DIRNAME.  Like `dired' but makes a new frame."
125       (interactive (dired-read-dir-and-switches "in other frame "))
126       (switch-to-buffer-other-frame (dired-noselect dirname switches))
127       )
128     )
129
130
131 ;;; @ string
132 ;;;
133
134 (defmacro char-list-to-string (char-list)
135   "Convert list of character CHAR-LIST to string. [emu-xemacs.el]"
136   `(mapconcat #'char-to-string ,char-list ""))
137
138
139 ;;; @ end
140 ;;;
141
142 (provide 'emu-xemacs)
143
144 ;;; emu-xemacs.el ends here