diff options
| author | Eli Zaretskii | 2008-10-20 23:14:36 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-10-20 23:14:36 +0000 |
| commit | 30ee26a9592a7784acccbc8a86e3060d5f1eca78 (patch) | |
| tree | ad8c934e63164533ae3345407e86ab585d3f6cf7 | |
| parent | fd6f900c21e90d5dd6661e7b29f5ffe2c049400c (diff) | |
| download | emacs-30ee26a9592a7784acccbc8a86e3060d5f1eca78.tar.gz emacs-30ee26a9592a7784acccbc8a86e3060d5f1eca78.zip | |
(apply-partially): Move from subr.el to simple.el.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/simple.el | 14 | ||||
| -rw-r--r-- | lisp/subr.el | 15 |
3 files changed, 19 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index da6ed5796a9..d378478ce7e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-10-20 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * subr.el (apply-partially): Move from here... | ||
| 4 | |||
| 5 | * simple.el (apply-partially): ...to here. | ||
| 6 | |||
| 1 | 2008-10-20 Andreas Schwab <schwab@suse.de> | 7 | 2008-10-20 Andreas Schwab <schwab@suse.de> |
| 2 | 8 | ||
| 3 | * subr.el (split-string-and-unquote): Simplify regexp. | 9 | * subr.el (split-string-and-unquote): Simplify regexp. |
diff --git a/lisp/simple.el b/lisp/simple.el index 9636f118932..7327a88c362 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -29,6 +29,9 @@ | |||
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | ;; This is for lexical-let in apply-partially. | ||
| 33 | (eval-when-compile (require 'cl)) | ||
| 34 | |||
| 32 | (declare-function widget-convert "wid-edit" (type &rest args)) | 35 | (declare-function widget-convert "wid-edit" (type &rest args)) |
| 33 | (declare-function shell-mode "shell" ()) | 36 | (declare-function shell-mode "shell" ()) |
| 34 | 37 | ||
| @@ -2478,7 +2481,6 @@ objects of file handler invocation." | |||
| 2478 | (if fh (apply fh 'start-file-process name buffer program program-args) | 2481 | (if fh (apply fh 'start-file-process name buffer program program-args) |
| 2479 | (apply 'start-process name buffer program program-args)))) | 2482 | (apply 'start-process name buffer program program-args)))) |
| 2480 | 2483 | ||
| 2481 | |||
| 2482 | 2484 | ||
| 2483 | (defvar universal-argument-map | 2485 | (defvar universal-argument-map |
| 2484 | (let ((map (make-sparse-keymap))) | 2486 | (let ((map (make-sparse-keymap))) |
| @@ -6247,6 +6249,16 @@ works by saving the value of `buffer-invisibility-spec' and setting it to nil." | |||
| 6247 | buffer-invisibility-spec) | 6249 | buffer-invisibility-spec) |
| 6248 | (setq buffer-invisibility-spec nil))) | 6250 | (setq buffer-invisibility-spec nil))) |
| 6249 | 6251 | ||
| 6252 | ;; Partial application of functions (similar to "currying"). | ||
| 6253 | (defun apply-partially (fun &rest args) | ||
| 6254 | "Return a function that is a partial application of FUN to ARGS. | ||
| 6255 | ARGS is a list of the first N arguments to pass to FUN. | ||
| 6256 | The result is a new function which does the same as FUN, except that | ||
| 6257 | the first N arguments are fixed at the values with which this function | ||
| 6258 | was called." | ||
| 6259 | (lexical-let ((fun fun) (args1 args)) | ||
| 6260 | (lambda (&rest args2) (apply fun (append args1 args2))))) | ||
| 6261 | |||
| 6250 | ;; Minibuffer prompt stuff. | 6262 | ;; Minibuffer prompt stuff. |
| 6251 | 6263 | ||
| 6252 | ;(defun minibuffer-prompt-modification (start end) | 6264 | ;(defun minibuffer-prompt-modification (start end) |
diff --git a/lisp/subr.el b/lisp/subr.el index a0077794b51..40311c4e1f4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3556,20 +3556,5 @@ is greater than \"1pre\" which is greater than \"1beta\" which is greater than | |||
| 3556 | \"1alpha\"." | 3556 | \"1alpha\"." |
| 3557 | (version-list-= (version-to-list v1) (version-to-list v2))) | 3557 | (version-list-= (version-to-list v1) (version-to-list v2))) |
| 3558 | 3558 | ||
| 3559 | |||
| 3560 | ;; This is for lexical-let in apply-partially. It is here because cl | ||
| 3561 | ;; needs various macros defined above. | ||
| 3562 | (eval-when-compile (require 'cl)) | ||
| 3563 | |||
| 3564 | (defun apply-partially (fun &rest args) | ||
| 3565 | "Return a function that is a partial application of FUN to ARGS. | ||
| 3566 | ARGS is a list of the first N arguments to pass to FUN. | ||
| 3567 | The result is a new function which does the same as FUN, except that | ||
| 3568 | the first N arguments are fixed at the values with which this function | ||
| 3569 | was called." | ||
| 3570 | (lexical-let ((fun fun) (args1 args)) | ||
| 3571 | (lambda (&rest args2) (apply fun (append args1 args2))))) | ||
| 3572 | |||
| 3573 | |||
| 3574 | ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc | 3559 | ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc |
| 3575 | ;;; subr.el ends here | 3560 | ;;; subr.el ends here |