2 ;;; emu-18.el --- Emacs 19.* emulation module for Emacs 18.*
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: emu-18.el,v 7.0 1995/10/12 11:27:33 morioka Exp $
10 ;;; Keywords: emulation, compatibility
12 ;;; This file is part of tl and tm (Tools for MIME).
18 ;; This function is imported from AUC TeX.
19 (defun add-hook (hook function &optional append)
20 "Add to the value of HOOK the function FUNCTION.
21 FUNCTION is not added if already present.
22 FUNCTION is added (if necessary) at the beginning of the hook list
23 unless the optional argument APPEND is non-nil, in which case
24 FUNCTION is added at the end.
26 HOOK should be a symbol, and FUNCTION may be any valid function. If
27 HOOK is void, it is first set to nil. If HOOK's value is a single
28 function, it is changed to a list of functions.
29 \[emu-18 Emacs 19 emulating function]"
33 ;; If the hook value is a single function, turn it into a list.
34 (let ((old (symbol-value hook)))
35 (if (or (not (listp old))
36 (eq (car old) 'lambda))
39 (or (if (consp function)
40 ;; Clever way to tell whether a given lambda-expression
41 ;; is equal to anything in the hook.
42 (let ((tail (assoc (cdr function) (symbol-value hook))))
45 (memq function (symbol-value hook))
49 (nconc (symbol-value hook) (list function))
50 (cons function (symbol-value hook))
58 (defun member (elt list)
59 "Return non-nil if ELT is an element of LIST. Comparison done with EQUAL.
60 The value is actually the tail of LIST whose car is ELT.
61 \[emu-18 Emacs 19 emulating function]"
62 (while (and list (not (equal elt (car list))))
63 (setq list (cdr list)))
70 (defun defalias (SYM NEWDEF)
71 "Set SYMBOL's function definition to NEWVAL, and return NEWVAL.
72 Associates the function with the current load file, if any.
73 \[emu-18 Emacs 19 emulating function]"
74 (fset SYM (symbol-function NEWDEF))
77 (defun byte-code-function-p (exp)
78 (let* ((rest (cdr (cdr exp))) elt)
79 (if (stringp (car rest))
80 (setq rest (cdr rest))
85 (if (and (consp elt)(eq (car elt) 'byte-code))
88 (setq rest (cdr rest))
95 (defun make-directory-internal (dirname)
96 "Create a directory. One argument, a file name string.
97 \[emu-18 Emacs 19 emulating function]"
98 (if (file-exists-p dirname)
99 (error "Creating directory: %s is already exist" dirname)
100 (if (not (= (call-process "mkdir" nil nil nil dirname) 0))
101 (error "Creating directory: no such file or directory, %s" dirname)
104 (defun make-directory (dir &optional parents)
105 "Create the directory DIR and any nonexistent parent dirs.
106 The second (optional) argument PARENTS says whether
107 to create parent directories if they don't exist.
108 \[emu-18 Emacs 19 emulating function]"
109 (let ((len (length dir))
112 (while (and (< p len) (string-match "[^/]*/?" dir p))
113 (setq p1 (match-end 0))
117 (setq path (substring dir 0 p1))
118 (if (not (file-directory-p path))
119 (cond ((file-exists-p path)
120 (error "Creating directory: %s is not directory" path)
123 (error "Creating directory: %s is not exist" path)
126 (make-directory-internal path)
131 (make-directory-internal dir)
138 (defvar mouse-button-1 nil)
139 (defvar mouse-button-2 nil)