[librep] added remove-hook-by-name func
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librep] added remove-hook-by-name func
- Date: Sat, 15 Jan 2011 18:29:32 +0000 (UTC)
commit c7da736dbdf0cb8b70d0289ebdda03036ec71add
Author: Christopher Roy Bratusek <zanghar freenet de>
Date: Sat Jan 15 19:10:15 2011 +0100
added remove-hook-by-name func
lisp/rep/system.jl | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lisp/rep/system.jl b/lisp/rep/system.jl
index 6d142b6..98be386 100644
--- a/lisp/rep/system.jl
+++ b/lisp/rep/system.jl
@@ -44,6 +44,18 @@ is true in which case it is added at the end."
"Remove FUNC from the hook HOOK (symbol)."
(set hook (delete func (symbol-value hook))))
+(defun remove-hook-by-name (hook name)
+ "Remove functions whose name is NAME (a string) from HOOK (a symbol)."
+ (when (symbolp name)
+ (setq name (symbol-name name)))
+ (set hook (delete-if (lambda (f)
+ (equal (or (and (closurep f)
+ (closure-name f))
+ (and (subrp f)
+ (subr-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."
(and (boundp hook-symbol) (memq fun (symbol-value hook-symbol))))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]