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