diff lisp/prim/subr.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents ec9a17fef872
children b9518feda344
line wrap: on
line diff
--- a/lisp/prim/subr.el	Mon Aug 13 09:00:04 2007 +0200
+++ b/lisp/prim/subr.el	Mon Aug 13 09:02:59 2007 +0200
@@ -17,18 +17,11 @@
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with XEmacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-;; 02111-1307, USA.
-
-;;; Synched up with: FSF 19.34.
+;; along with XEmacs; see the file COPYING.  If not, write to the 
+;; Free Software Foundation, 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
-;;; Commentary:
-
-;; There's not a whole lot in common now with the FSF version,
-;; be wary when applying differences.  I've left in a number of lines
-;; of commentary just to give diff(1) something to synch itself with to
-;; provide useful context diffs. -sb
+;;; Synched up with: FSF 19.30.
 
 ;;; Code:
 
@@ -70,28 +63,9 @@
   `(if (fboundp ,(car args))
        nil
      (define-function ,@args)))
-
-;;;; Keymap support.
-;; XEmacs: removed to keymap.el
 
-;;;; The global keymap tree.  
-
-;;; global-map, esc-map, and ctl-x-map have their values set up in
-;;; keymap.c; we just give them docstrings here.
-
-;;;; Event manipulation functions.
-
-;; The call to `read' is to ensure that the value is computed at load time
-;; and not compiled into the .elc file.  The value is negative on most
-;; machines, but not on all!
-;; XEmacs: This stuff is done in C Code.
-
-;;;; Obsolescent names for functions.
-;; XEmacs: not used.
-
-;; XEmacs:
 (define-function 'not 'null)
-(define-function-when-void 'numberp 'integerp) ; different when floats
+(define-function-when-void 'numberp 'intergerp) ; different when floats
 
 (defun local-variable-if-set-p (sym buffer)
   "Return t if SYM would be local to BUFFER after it is set.
@@ -103,8 +77,6 @@
 
 ;;;; Hook manipulation functions.
 
-;; (defconst run-hooks 'run-hooks ...)
-
 (defun make-local-hook (hook)
   "Make the hook HOOK local to the current buffer.
 When a hook is local, its local and global values
@@ -123,7 +95,7 @@
 buffer.
 
 Do not use `make-local-variable' to make a hook variable buffer-local."
-  (if (local-variable-p hook (current-buffer)) ; XEmacs
+  (if (local-variable-p hook (current-buffer))
       nil
     (or (boundp hook) (set hook nil))
     (make-local-variable hook)
@@ -145,6 +117,7 @@
 HOOK should be a symbol, and FUNCTION may be any valid function.  If
 HOOK is void, it is first set to nil.  If HOOK's value is a single
 function, it is changed to a list of functions."
+  ;(interactive "SAdd to hook-var (symbol): \naAdd which function to %s? ")
   (or (boundp hook) (set hook nil))
   (or (default-boundp hook) (set-default hook nil))
   ;; If the hook value is a single function, turn it into a list.
@@ -154,7 +127,7 @@
   (if (or local
 	  ;; Detect the case where make-local-variable was used on a hook
 	  ;; and do what we used to do.
-	  (and (local-variable-if-set-p hook (current-buffer)) ; XEmacs
+	  (and (local-variable-if-set-p hook (current-buffer))
 	       (not (memq t (symbol-value hook)))))
       ;; Alter the local value only.
       (or (if (consp function)
@@ -212,7 +185,6 @@
 
 (defun add-to-list (list-var element)
   "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
-The test for presence of ELEMENT is done with `equal'.
 If you want to use `add-to-list' on a variable that is not defined
 until a certain package is loaded, you should put the call to `add-to-list'
 into a hook function that will be run only after loading the package.
@@ -221,7 +193,6 @@
   (or (member element (symbol-value list-var))
       (set list-var (cons element (symbol-value list-var)))))
 
-;; XEmacs additions
 ;; called by Fkill_buffer()
 (defvar kill-buffer-hook nil
   "Function or functions to be called when a buffer is killed.
@@ -237,7 +208,6 @@
 (define-function 'rplaca 'setcar)
 (define-function 'rplacd 'setcdr)
 
-;; XEmacs
 (defun mapvector (__function __seq)
   "Apply FUNCTION to each element of SEQ, making a vector of the results.
 The result is a vector of the same length as SEQ.
@@ -254,7 +224,6 @@
 
 ;;;; String functions.
 
-;; XEmacs
 (defun replace-in-string (str regexp newtext &optional literal)
   "Replaces all matches in STR for REGEXP with NEWTEXT string.
 Optional LITERAL non-nil means do a literal replacement.
@@ -330,36 +299,6 @@
 	   (buffer-string)
 	 (erase-buffer)))))
 
-(defmacro with-temp-buffer (&rest forms)
-  "Create a temporary buffer, and evaluate FORMS there like `progn'."
-  (let ((temp-buffer (make-symbol "temp-buffer")))
-    `(let ((,temp-buffer
-	    (get-buffer-create (generate-new-buffer-name " *temp*"))))
-       (unwind-protect
-	   (save-excursion
-	     (set-buffer ,temp-buffer)
-	     ,@forms)
-	 (and (buffer-name ,temp-buffer)
-	      (kill-buffer ,temp-buffer))))))
-
-;; Moved from 20.1:lisp/mule/mule-coding.el.
-(defmacro with-string-as-buffer-contents (str &rest body)
-  "With the contents of the current buffer being STR, run BODY.
-Returns the new contents of the buffer, as modified by BODY.
-The original current buffer is restored afterwards."
-  `(let ((curbuf (current-buffer))
-         (tempbuf (get-buffer-create " *string-as-buffer-contents*")))
-     (unwind-protect
-         (progn
-           (set-buffer tempbuf)
-           (buffer-disable-undo (current-buffer))
-           (erase-buffer)
-           (insert ,str)
-           ,@body
-           (buffer-string))
-       (erase-buffer tempbuf)
-       (set-buffer curbuf))))
-
 (defun insert-face (string face)
   "Insert STRING and highlight with FACE.  Returns the extent created."
   (let ((p (point)) ext)
@@ -469,7 +408,7 @@
 (defmacro check-argument-type (predicate argument)
   "Check that ARGUMENT satisfies PREDICATE.
 If not, signal a continuable `wrong-type-argument' error until the
-returned value satisfies PREDICATE, and assign the returned value
+returned value satifies PREDICATE, and assign the returned value
 to ARGUMENT."
   `(if (not (,(eval predicate) ,argument))
        (setq ,argument
@@ -563,7 +502,7 @@
 ;; to this, so I'm leaving this undefined for now. --ben
 
 ;;; The objection is this: there is more than one way to load the same file.
-;;; "foo", "foo.elc", "foo.el", and "/some/path/foo.elc" are all different
+;;; "foo", "foo.elc", "foo.el", and "/some/path/foo.elc" are all differrent
 ;;; ways to load the exact same code.  `eval-after-load' is too stupid to
 ;;; deal with this sort of thing.  If this sort of feature is desired, then
 ;;; it should work off of a hook on `provide'.  Features are unique and
@@ -571,30 +510,30 @@
 
 ;;;; Specifying things to do after certain files are loaded.
 
-(defun eval-after-load (file form)
-  "Arrange that, if FILE is ever loaded, FORM will be run at that time.
-This makes or adds to an entry on `after-load-alist'.
-If FILE is already loaded, evaluate FORM right now.
-It does nothing if FORM is already on the list for FILE.
-FILE should be the name of a library, with no directory name."
-  ;; Make sure there is an element for FILE.
-  (or (assoc file after-load-alist)
-      (setq after-load-alist (cons (list file) after-load-alist)))
-  ;; Add FORM to the element if it isn't there.
-  (let ((elt (assoc file after-load-alist)))
-    (or (member form (cdr elt))
-	(progn
-	  (nconc elt (list form))
-	  ;; If the file has been loaded already, run FORM right away.
-	  (and (assoc file load-history)
-	       (eval form)))))
-  form)
-
-(defun eval-next-after-load (file)
-  "Read the following input sexp, and run it whenever FILE is loaded.
-This makes or adds to an entry on `after-load-alist'.
-FILE should be the name of a library, with no directory name."
-  (eval-after-load file (read)))
+;(defun eval-after-load (file form)
+;  "Arrange that, if FILE is ever loaded, FORM will be run at that time.
+;This makes or adds to an entry on `after-load-alist'.
+;If FILE is already loaded, evaluate FORM right now.
+;It does nothing if FORM is already on the list for FILE.
+;FILE should be the name of a library, with no directory name."
+;  ;; Make sure there is an element for FILE.
+;  (or (assoc file after-load-alist)
+;      (setq after-load-alist (cons (list file) after-load-alist)))
+;  ;; Add FORM to the element if it isn't there.
+;  (let ((elt (assoc file after-load-alist)))
+;    (or (member form (cdr elt))
+;	(progn
+;	  (nconc elt (list form))
+;	  ;; If the file has been loaded already, run FORM right away.
+;	  (and (assoc file load-history)
+;	       (eval form)))))
+;  form)
+;
+;(defun eval-next-after-load (file)
+;  "Read the following input sexp, and run it whenever FILE is loaded.
+;This makes or adds to an entry on `after-load-alist'.
+;FILE should be the name of a library, with no directory name."
+;  (eval-after-load file (read)))
 
 ; alternate names (not obsolete)
 (if (not (fboundp 'mod)) (define-function 'mod '%))
@@ -608,5 +547,3 @@
 (define-function 'set-match-data 'store-match-data)
 (define-function 'send-string-to-terminal 'external-debugging-output)
 (define-function 'buffer-string 'buffer-substring)
-
-;;; subr.el ends here