emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/simple.el,v


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el,v
Date: Mon, 20 Oct 2008 23:12:45 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Eli Zaretskii <eliz>    08/10/20 23:12:44

Index: simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.948
retrieving revision 1.949
diff -u -b -r1.948 -r1.949
--- simple.el   19 Oct 2008 15:01:05 -0000      1.948
+++ simple.el   20 Oct 2008 23:12:44 -0000      1.949
@@ -29,6 +29,9 @@
 
 ;;; Code:
 
+;; This is for lexical-let in apply-partially.
+(eval-when-compile (require 'cl))
+
 (declare-function widget-convert "wid-edit" (type &rest args))
 (declare-function shell-mode "shell" ())
 
@@ -2479,7 +2482,6 @@
       (apply 'start-process name buffer program program-args))))
 
 
-
 (defvar universal-argument-map
   (let ((map (make-sparse-keymap)))
     (define-key map [t] 'universal-argument-other-key)
@@ -6247,6 +6249,16 @@
         buffer-invisibility-spec)
     (setq buffer-invisibility-spec nil)))
 
+;; Partial application of functions (similar to "currying").
+(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)))))
+
 ;; Minibuffer prompt stuff.
 
 ;(defun minibuffer-prompt-modification (start end)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]