From b8fc05a9f2f9b6296b43b8b7fb0acfc88b846c08 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii <eliz@gnu.org> Date: Sun, 19 Oct 2008 21:07:17 +0000 Subject: [PATCH] (apply-partially): Move from minibuffer.el to subr.el. --- lisp/ChangeLog | 2 ++ lisp/minibuffer.el | 8 -------- lisp/subr.el | 9 +++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 77925f3beb6..2ae4b90e7b1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2008-10-19 Eli Zaretskii <eliz@gnu.org> + * subr.el (apply-partially): Moved here from minibuffer.el. Doc fix. + * simple.el (minibuffer-default-add-shell-commands): Doc fix. 2008-10-19 Martin Rudalics <rudalics@gmx.at> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index b64a8d08ae5..7626b5d1352 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -96,14 +96,6 @@ Like CL's `some'." (or res (if firsterror (signal (car firsterror) (cdr firsterror)))))) -(defun apply-partially (fun &rest args) - "Do a \"curried\" 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 that takes the remaining arguments, -and calls FUN." - (lexical-let ((fun fun) (args1 args)) - (lambda (&rest args2) (apply fun (append args1 args2))))) - (defun complete-with-action (action table string pred) "Perform completion ACTION. STRING is the string to complete. diff --git a/lisp/subr.el b/lisp/subr.el index d62b38b00d4..d078f3dd9ef 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. -- 2.39.5