(dired-other-frame): Use `defun-maybe'.
[elisp/apel.git] / poe-xemacs.el
1 ;;; poe-xemacs.el --- poe API implementation for XEmacs
2
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
5
6 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Keywords: emulation, compatibility, XEmacs
8
9 ;; This file is part of APEL (A Portable Emacs Library).
10
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
15
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;; 02111-1307, USA.
25
26 ;;; Code:
27
28 ;;; @ face
29 ;;;
30
31 (or (fboundp 'face-list)
32     (defalias 'face-list 'list-faces))
33
34 (or (memq 'underline (face-list))
35     (and (fboundp 'make-face)
36          (make-face 'underline)))
37
38 (or (face-differs-from-default-p 'underline)
39     (set-face-underline-p 'underline t))
40
41
42 ;;; @ overlay
43 ;;;
44
45 (condition-case nil
46     (require 'overlay)
47   (error (defalias 'make-overlay 'make-extent)
48          (defalias 'overlay-put 'set-extent-property)
49          (defalias 'overlay-buffer 'extent-buffer)
50          (defun move-overlay (extent start end &optional buffer)
51            (set-extent-endpoints extent start end)
52            )
53          ))
54
55
56 ;;; @ dired
57 ;;;
58
59 (defun-maybe dired-other-frame (dirname &optional switches)
60   "\"Edit\" directory DIRNAME.  Like `dired' but makes a new frame."
61   (interactive (dired-read-dir-and-switches "in other frame "))
62   (switch-to-buffer-other-frame (dired-noselect dirname switches))
63   )
64
65
66 ;;; @ to avoid bug of XEmacs 19.14
67 ;;;
68
69 (or (string-match "^../"
70                   (file-relative-name "/usr/local/share" "/usr/local/lib"))
71     ;; This function was imported from Emacs 19.33.
72     (defun file-relative-name (filename &optional directory)
73       "Convert FILENAME to be relative to DIRECTORY
74 (default: default-directory). [poe-xemacs.el]"
75       (setq filename (expand-file-name filename)
76             directory (file-name-as-directory
77                        (expand-file-name
78                         (or directory default-directory))))
79       (let ((ancestor ""))
80         (while (not (string-match (concat "^" (regexp-quote directory))
81                                   filename))
82           (setq directory (file-name-directory (substring directory 0 -1))
83                 ancestor (concat "../" ancestor)))
84         (concat ancestor (substring filename (match-end 0)))))
85     )
86
87     
88 ;;; @ Emacs 20.3 emulation
89 ;;;
90
91 (or (fboundp 'line-beginning-position)
92     (defalias 'line-beginning-position 'point-at-bol))
93
94 (or (fboundp 'line-end-position)
95     (defalias 'line-end-position 'point-at-eol))
96
97
98 ;;; @ end
99 ;;;
100
101 (provide 'poe-xemacs)
102
103 ;;; poe-xemacs.el ends here