;; 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.
;; 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:
(provide 'localhook) ; beware of circular dependency.
(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.
(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)))))
(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)))))))
(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)
(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.
not `make-local-variable'."
(run-hook-with-args-internal hook args t))
-;;; @ End.
-;;;
-
-;;; localhook.el ends here.
+;;; localhook.el ends here
;; Author: Mikio Nakajima <minakaji@osaka.email.ne.jp>
;; Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
-;; Maintainer: Mikio Nakajima <minakaji@osaka.email.ne.jp>
;; Keywords: emulating, custom
;; This file is part of APEL (A Portable Emacs Library).
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
+;;; Commentary:
+
;;; Code:
(require 'poe)
-;; If old compiler is used under v18, `eval-when-compile' and
-;; `static-if' are expanded (and evaluated) at *load-time*.
(eval-when-compile (require 'static))
-;; XXX: needs better abstraction.
(static-if (condition-case nil
;; compile-time check.
;; "new custom" requires widget library.
nil))
;; you have "new custom". no load-time check.
(require 'custom)
- ;; your custom is "old custom", or you don't have custom library
- ;; at compile-time.
+ ;; your custom is "old custom",
+ ;; or you don't have custom library at compile-time.
(or (condition-case nil
;; load-time check.
;; load "custom" if exists.
(and (require 'custom)
(fboundp 'custom-declare-variable))
(error nil))
- ;; your custom is "old custom", or you don't have custom library.
+ ;; your custom is "old custom",
+ ;; or you don't have custom library.
;; load emulation version of "new custom".
(require 'tinycustom)))
(provide 'pcustom)
-;; end of pcustom.el
+;;; pcustom.el ends here