(Download): Renamed from "Anonymous FTP"; modify for
[elisp/apel.git] / localhook.el
index d0b392c..b8bd7e9 100644 (file)
@@ -1,7 +1,6 @@
 ;;; localhook.el --- local hook variable support in emacs-lisp.
 
-;; Copyright (C) 1985, 1986, 1992, 1994, 1995 Free Software Foundation, Inc.
-;; Copyright (C) 1999 Shuhei KOBAYASHI
+;; Copyright (C) 1985,86,92,94,95,1999 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
 ;; Keywords: compatibility
@@ -20,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;;     run-hooks, run-hook-with-args,
 ;;     run-hook-with-args-until-success, and
 ;;     run-hook-with-args-until-failure.
-;;
+
 ;; The following functions which do not exist in 19.28 are used in the
 ;; original definitions of add-hook, remove-hook, and make-local-hook.
 ;;
 ;;     local-variable-p, and local-variable-if-set-p.
 ;;
 ;; In this file, these functions are replaced with mock versions.
-;;
+
 ;; In addition, the following functions which do not exist in v18 are used.
 ;;
 ;;     default-boundp, byte-code-function-p, functionp, member, and delete.
@@ -47,6 +46,7 @@
 ;; These functions are provided by poe-18.el.
 
 ;; For historians:
+;;
 ;;     `add-hook' and `remove-hook' were introduced in v19.
 ;;
 ;;     Local hook feature and `make-local-hook' were introduced in 19.29.
 ;;     `run-hook-with-args' was introduced in 19.23 as a lisp function.
 ;;     Two variants of `run-hook-with-args' were introduced in 19.29 as
 ;;     lisp functions.  `run-hook' family became C primitives in 19.30.
-;;
-;;     (Needs XEmacs info: it seems XEmacs 21 is synched up with 19.30.)
 
 ;;; Code:
 
-(require 'poe)
+;; beware of circular dependency.
+(require 'product)
+(product-provide (provide 'localhook) (require 'apel-ver))
+
+(require 'poe)                         ; this file is loaded from poe.el.
 
-;;; These two functions are not complete, but work enough for our purpose.
+;; These two functions are not complete, but work enough for our purpose.
 ;;
 ;; (defun local-variable-p (variable &optional buffer)
 ;;   "Non-nil if VARIABLE has a local binding in buffer BUFFER.
 ;;        (memq variable (buffer-local-variables buffer))); local but void.
 ;;        ;; docstring is ambiguous; 20.3 returns bool value.
 ;;        t))
+\f
+;;; Hook manipulation functions.
 
-;;; @ Hook manipulation functions.
-;;;
-
-;;; The following three functions are imported from emacs-20.3/lisp/subr.el.
-;;; (local-variable-p, and local-variable-if-set-p are replaced.)
+;; The following three functions are imported from emacs-20.3/lisp/subr.el.
+;; (local-variable-p, and local-variable-if-set-p are expanded.)
 (defun make-local-hook (hook)
   "Make the hook HOOK local to the current buffer.
 The return value is HOOK.
@@ -147,7 +148,7 @@ function, it is changed to a list of functions."
       (or (if (or (consp function) (byte-code-function-p function))
              (member function (symbol-value hook))
            (memq function (symbol-value hook)))
-         (set hook 
+         (set hook
               (if append
                   (append (symbol-value hook) (list function))
                 (cons function (symbol-value hook)))))
@@ -156,7 +157,7 @@ function, it is changed to a list of functions."
     (or (if (or (consp function) (byte-code-function-p function))
            (member function (default-value hook))
          (memq function (default-value hook)))
-       (set-default hook 
+       (set-default hook
                     (if append
                         (append (default-value hook) (list function))
                       (cons function (default-value hook)))))))
@@ -200,19 +201,17 @@ To make a hook variable buffer-local, always use
              (setq hook-value nil)))
        (set-default hook hook-value)))))
 \f
-
-;;; @ Hook execution functions.
-;;;
+;;; Hook execution functions.
 
 (defun run-hook-with-args-internal (hook args cond)
-;;   "Run HOOK with the specified arguments ARGS.
-;; HOOK should be a symbol, a hook variable.  Its value should be a list of
-;; functions.  We call those functions, one by one, passing arguments ARGS
-;; to each of them, until specified COND is satisfied.  If COND is nil, we
-;; call those functions until one of them returns a non-nil value, and then
-;; we return that value.  If COND is t, we call those functions until one
-;; of them returns nil, and then we return nil.  If COND is not nil and not
-;; t, we call all the functions."
+  "Run HOOK with the specified arguments ARGS.
+HOOK should be a symbol, a hook variable.  Its value should be a list of
+functions.  We call those functions, one by one, passing arguments ARGS
+to each of them, until specified COND is satisfied.  If COND is nil, we
+call those functions until one of them returns a non-nil value, and then
+we return that value.  If COND is t, we call those functions until one
+of them returns nil, and then we return nil.  If COND is not nil and not
+t, we call all the functions."
   (if (not (boundp hook))
       ;; hook is void.
       (not cond)
@@ -250,8 +249,8 @@ To make a hook variable buffer-local, always use
            (setq ret (apply function args))))
        ret))))
 
-;;; The following four functions are direct translation of their
-;;; C definitions of emacs-20.3/src/eval.c.
+;; The following four functions are direct translation of their
+;; C definitions in emacs-20.3/src/eval.c.
 (defun run-hooks (&rest hooks)
   "Run each hook in HOOKS.  Major mode functions use this.
 Each argument should be a symbol, a hook variable.
@@ -306,9 +305,4 @@ To make a hook variable buffer-local, use `make-local-hook',
 not `make-local-variable'."
   (run-hook-with-args-internal hook args t))
 
-;;; @ End.
-;;;
-
-(provide 'localhook)
-
-;;; localhook.el ends here.
+;;; localhook.el ends here