[librep] Implements new function "function-name".
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librep] Implements new function "function-name".
- Date: Sat, 19 Feb 2011 07:27:05 +0000 (UTC)
commit 50c9b8917ea166dd492e453d77d9e73816345223
Author: Teika kazura <teika lavabit com>
Date: Sat Feb 5 20:51:40 2011 +0900
Implements new function "function-name".
lisp/rep/lang/interpreter.jl | 10 +++++++++-
man/lang.texi | 7 ++++++-
man/news.texi | 6 ++++--
3 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/lisp/rep/lang/interpreter.jl b/lisp/rep/lang/interpreter.jl
index c614bd0..c3fdd02 100644
--- a/lisp/rep/lang/interpreter.jl
+++ b/lisp/rep/lang/interpreter.jl
@@ -579,12 +579,20 @@ into the compiled program. When interpreted, nil is returned."
"A do-nothing command."
(interactive))
+(defun function-name (func)
+ "Returns the function's name (a symbol)."
+ (if (and (functionp func) (subrp func)) ;; subrp is t for special form, too
+ (intern (subr-name func))
+ (and (closure-name func)
+ (intern (closure-name func)))))
+
(autoload-macro 'define "rep/lang/define")
(autoload-macro 'define-macro "rep/lang/define")
(autoload-macro 'with-internal-definitions "rep/lang/define")
(export-bindings '(error identity eval-when-compile nop interactive eval
- define define-macro with-internal-definitions))
+ define define-macro with-internal-definitions
+ function-name))
;; do this last since declare is defined in this file
(declare (in-module rep.lang.interpreter))
diff --git a/man/lang.texi b/man/lang.texi
index e621a52..b6754fd 100644
--- a/man/lang.texi
+++ b/man/lang.texi
@@ -3750,8 +3750,13 @@ as the function argument of @code{funcall}.
@end lisp
@end defun
+ defun function-name arg
+Return's the name of the function @var{arg} (a symbol).
+ end defun
+
@defun subrp arg
Returns true is @var{arg} is a primitive subroutine object.
+This includes special forms.
@end defun
@defun subr-name subr
@@ -5423,7 +5428,7 @@ convenient looping construct.
@defmac let function bindings body dots{}
This is the same as the @code{(let @var{bindings} @var{body} dots{})}
form described in @ref{Local Variables}, but within the
- var{body}@dots{} forms, the symbol @var{fuction} is bound to a
+ var{body}@dots{} forms, the symbol @var{function} is bound to a
function whose parameters are the bound variables defined by
@var{bindings} and whose body is the sequence of forms
@var{body} dots{}
diff --git a/man/news.texi b/man/news.texi
index cc75dfc..62dcdfa 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -13,9 +13,11 @@ A new module containing utils for rep's ffi binding is added.
@item Fixed librep.pc to prevent a possible build issue in rep-gtk or sawfish
(occured on fedora 14) [Christopher Bratusek]
- item @code{remove-hook-by-name} function [Teika Kazura]
+ item New functions [Teika Kazura]
-This function removes functions from hooks by their name.
+ code{function-name} returns the name of the function object. (@pxref{Functions})
+
+ code{remove-hook-by-name} removes functions from a hook by their name. (@pxref{Normal Hooks})
@item Documentation [Teika kazura]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]