2 ;;; emu-18.el --- Emacs 19.* emulation module for Emacs 18.*
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: emu-18.el,v 7.5 1996/01/25 02:09:46 morioka Exp $
10 ;;; Keywords: emulation, compatibility
12 ;;; This file is part of tl (Tiny Library).
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.
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.
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.
33 ;; This function is imported from AUC TeX.
34 (defun add-hook (hook function &optional append)
35 "Add to the value of HOOK the function FUNCTION.
36 FUNCTION is not added if already present.
37 FUNCTION is added (if necessary) at the beginning of the hook list
38 unless the optional argument APPEND is non-nil, in which case
39 FUNCTION is added at the end.
41 HOOK should be a symbol, and FUNCTION may be any valid function. If
42 HOOK is void, it is first set to nil. If HOOK's value is a single
43 function, it is changed to a list of functions.
44 \[emu-18.el; Emacs 19 emulating function]"
48 ;; If the hook value is a single function, turn it into a list.
49 (let ((old (symbol-value hook)))
50 (if (or (not (listp old))
51 (eq (car old) 'lambda))
54 (or (if (consp function)
55 ;; Clever way to tell whether a given lambda-expression
56 ;; is equal to anything in the hook.
57 (let ((tail (assoc (cdr function) (symbol-value hook))))
60 (memq function (symbol-value hook))
64 (nconc (symbol-value hook) (list function))
65 (cons function (symbol-value hook))
73 (defun member (elt list)
74 "Return non-nil if ELT is an element of LIST. Comparison done with EQUAL.
75 The value is actually the tail of LIST whose car is ELT.
76 \[emu-18.el; Emacs 19 emulating function]"
77 (while (and list (not (equal elt (car list))))
78 (setq list (cdr list)))
81 (defun delete (elt list)
82 "Delete by side effect any occurrences of ELT as a member of LIST.
83 The modified LIST is returned. Comparison is done with `equal'.
84 If the first member of LIST is ELT, deleting it is not a side effect;
85 it is simply using a different list.
86 Therefore, write `(setq foo (delete element foo))'
87 to be sure of changing the value of `foo'.
88 \[emu-18.el; Emacs 19 emulating function]"
89 (if (equal elt (car list))
94 (while (and rrest (not (equal elt (car rrest))))
98 (rplacd rest (cdr rrest))
105 (defun defalias (SYM NEWDEF)
106 "Set SYMBOL's function definition to NEWVAL, and return NEWVAL.
107 Associates the function with the current load file, if any.
108 \[emu-18.el; Emacs 19 emulating function]"
109 (fset SYM (symbol-function NEWDEF))
112 (defun byte-code-function-p (exp)
113 "T if OBJECT is a byte-compiled function object.
114 \[emu-18.el; Emacs 19 emulating function]"
116 (let* ((rest (cdr (cdr exp))) elt)
117 (if (stringp (car rest))
118 (setq rest (cdr rest))
122 (setq elt (car rest))
123 (if (and (consp elt)(eq (car elt) 'byte-code))
126 (setq rest (cdr rest))
134 (defun make-directory-internal (dirname)
135 "Create a directory. One argument, a file name string.
136 \[emu-18.el; Emacs 19 emulating function]"
137 (if (file-exists-p dirname)
138 (error "Creating directory: %s is already exist" dirname)
139 (if (not (= (call-process "mkdir" nil nil nil dirname) 0))
140 (error "Creating directory: no such file or directory, %s" dirname)
143 (defun make-directory (dir &optional parents)
144 "Create the directory DIR and any nonexistent parent dirs.
145 The second (optional) argument PARENTS says whether
146 to create parent directories if they don't exist.
147 \[emu-18.el; Emacs 19 emulating function]"
148 (let ((len (length dir))
151 (while (and (< p len) (string-match "[^/]*/?" dir p))
152 (setq p1 (match-end 0))
156 (setq path (substring dir 0 p1))
157 (if (not (file-directory-p path))
158 (cond ((file-exists-p path)
159 (error "Creating directory: %s is not directory" path)
162 (error "Creating directory: %s is not exist" path)
165 (make-directory-internal path)
170 (make-directory-internal dir)
177 (or (fboundp 'si:mark)
178 (fset 'si:mark (symbol-function 'mark)))
179 (defun mark (&optional force)
187 (defvar mouse-button-1 nil)
188 (defvar mouse-button-2 nil)
189 (defvar mouse-button-3 nil)
197 ;;; emu-18.el ends here