diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-10-15 17:55:33 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-10-15 17:55:33 -0400 |
commit | 0c747cb143fa227e78f350ac353d703f489209df (patch) | |
tree | 5b434055c797bd75eaa1e3d9d0773e586d44daee /lisp/subr.el | |
parent | a01a7932080e8a6e7bc8472c58cefabcc2c37df3 (diff) | |
parent | aa095b2db98ae149737f8de00ee733b1d257ed33 (diff) | |
download | emacs-0c747cb143fa227e78f350ac353d703f489209df.tar.gz |
Merge from trunk
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index d7df38626bd..1503fbab14b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1,7 +1,8 @@ ;;; subr.el --- basic lisp subroutines for Emacs ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal @@ -288,14 +289,11 @@ If LIST is nil, return nil. If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." (if n - (let ((m 0) (p list)) - (while (consp p) - (setq m (1+ m) p (cdr p))) - (if (<= n 0) p - (if (< n m) (nthcdr (- m n) list) list))) - (while (consp (cdr list)) - (setq list (cdr list))) - list)) + (and (>= n 0) + (let ((m (safe-length list))) + (if (< n m) (nthcdr (- m n) list) list))) + (and list + (nthcdr (1- (safe-length list)) list)))) (defun butlast (list &optional n) "Return a copy of LIST with the last N elements removed." @@ -1023,7 +1021,6 @@ and `event-end' functions." (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer "22.1") (define-obsolete-function-alias 'string-to-int 'string-to-number "22.1") -(make-obsolete 'char-bytes "now always returns 1." "20.4") (make-obsolete 'forward-point "use (+ (point) N) instead." "23.1") (defun insert-string (&rest args) @@ -1098,11 +1095,6 @@ is converted into a string by expressing it in decimal." (make-obsolete 'process-filter-multibyte-p nil "23.1") (make-obsolete 'set-process-filter-multibyte nil "23.1") -(defconst directory-sep-char ?/ - "Directory separator character for built-in functions that return file names. -The value is always ?/.") -(make-obsolete-variable 'directory-sep-char "do not use it, just use `/'." "21.1") - (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." @@ -1169,37 +1161,6 @@ to reread, so it now uses nil to mean `no event', instead of -1." ;;;; Hook manipulation functions. -(defun make-local-hook (hook) - "Make the hook HOOK local to the current buffer. -The return value is HOOK. - -You never need to call this function now that `add-hook' does it for you -if its LOCAL argument is non-nil. - -When a hook is local, its local and global values -work in concert: running the hook actually runs all the hook -functions listed in *either* the local value *or* the global value -of the hook variable. - -This function works by making t a member of the buffer-local value, -which acts as a flag to run the hook functions in the default value as -well. This works for all normal hooks, but does not work for most -non-normal hooks yet. We will be changing the callers of non-normal -hooks so that they can handle localness; this has to be done one by -one. - -This function does nothing if HOOK is already local in the current -buffer. - -Do not use `make-local-variable' to make a hook variable buffer-local." - (if (local-variable-p hook) - nil - (or (boundp hook) (set hook nil)) - (make-local-variable hook) - (set hook (list t))) - hook) -(make-obsolete 'make-local-hook "not necessary any more." "21.1") - (defun add-hook (hook function &optional append local) "Add to the value of HOOK the function FUNCTION. FUNCTION is not added if already present. @@ -2426,8 +2387,9 @@ Otherwise, return nil." (or (stringp object) (null object))) (defun booleanp (object) - "Return non-nil if OBJECT is one of the two canonical boolean values: t or nil." - (memq object '(nil t))) + "Return t if OBJECT is one of the two canonical boolean values: t or nil. +Otherwise, return nil." + (and (memq object '(nil t)) t)) (defun field-at-pos (pos) "Return the field at position POS, taking stickiness etc into account." |