aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2008-10-19 21:07:17 +0000
committerEli Zaretskii <[email protected]>2008-10-19 21:07:17 +0000
commitb8fc05a9f2f9b6296b43b8b7fb0acfc88b846c08 (patch)
tree6508aece0978dad68255f9e84173a84a447267a8 /lisp/subr.el
parentd6328fba7f9e39c3280c7078b4b4452a96210b39 (diff)
(apply-partially): Move from minibuffer.el to subr.el.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index d62b38b00d..d078f3dd9e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2254,6 +2254,15 @@ Otherwise, return nil."
(get-char-property (1- (field-end pos)) 'field)
raw-field)))
+(defun apply-partially (fun &rest args)
+ "Return a function that is a partial application of FUN to ARGS.
+ARGS is a list of the first N arguments to pass to FUN.
+The result is a new function which does the same as FUN, except that
+the first N arguments are fixed at the values with which this function
+was called."
+ (lexical-let ((fun fun) (args1 args))
+ (lambda (&rest args2) (apply fun (append args1 args2)))))
+
;;;; Support for yanking and text properties.