[librep] remove-hook bugfix: It doesn't signal error when the hook is unbound.
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librep] remove-hook bugfix: It doesn't signal error when the hook is unbound.
- Date: Sat, 19 Feb 2011 07:27:20 +0000 (UTC)
commit 0e3d7ae01e730018d90671db2df450575923b646
Author: Teika kazura <teika lavabit com>
Date: Sat Feb 12 19:40:52 2011 +0900
remove-hook bugfix: It doesn't signal error when the hook is unbound.
lisp/rep/system.jl | 10 ++++++----
man/news.texi | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/lisp/rep/system.jl b/lisp/rep/system.jl
index 72dd432..4d30c26 100644
--- a/lisp/rep/system.jl
+++ b/lisp/rep/system.jl
@@ -43,13 +43,15 @@ is true in which case it is added at the end."
(defun remove-hook (hook func)
"Remove FUNC from the hook HOOK (symbol)."
- (set hook (delete func (symbol-value hook))))
+ (when (boundp hook)
+ (set hook (delete func (symbol-value hook)))))
(defun remove-hook-by-name (hook name)
"Remove functions whose name is NAME from HOOK (a symbol)."
- (set hook (delete-if (lambda (f)
- (eq (function-name f) name))
- (symbol-value hook))))
+ (when (boundp hook)
+ (set hook (delete-if (lambda (f)
+ (eq (function-name f) name))
+ (symbol-value hook)))))
(defun in-hook-p (hook-symbol fun)
"Returns t if the function FUN is stored in the hook called HOOK-SYMBOL."
diff --git a/man/news.texi b/man/news.texi
index f2813c8..dfe39c5 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -26,6 +26,8 @@ Function @code{in-hook-p} now has the documentation. (@pxref{Normal Hooks})
New sections ``Module Aliases'' (@pxref{Module Aliases}), ``Module Limits''
(@pxref{Module Limits}).
+ item Minor bugfix: @code{remove-hook} used to emit an error if the hook was unbound, but it's fixed. [Teika kazura]
+
@item fixed the spec-file [Kim B. Heino]
@item debian/control compat with Debian/Experimental [Christopher Bratusek]
@end itemize
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]