changeset 25608:1cdab17df2b3

(Fbufsize): Accept an extra BUFFER parameter.
author Richard M. Stallman <rms@gnu.org>
date Wed, 08 Sep 1999 07:56:20 +0000
parents e1f5592218c1
children 157f0e91232e
files src/editfns.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Wed Sep 08 07:54:18 1999 +0000
+++ b/src/editfns.c	Wed Sep 08 07:56:20 1999 +0000
@@ -427,13 +427,18 @@
   return unbind_to (count, val);
 }
 
-DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 0, 0,
-  "Return the number of characters in the current buffer.")
-  ()
+DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0,
+  "Return the number of characters in the current buffer.\n\
+If BUFFER, return the number of characters in that buffer instead.")
+  (buffer)
+     Lisp_Object buffer;
 {
-  Lisp_Object temp;
-  XSETFASTINT (temp, Z - BEG);
-  return temp;
+  if (NILP (buffer))
+    return make_number (Z - BEG);
+  else {
+    CHECK_BUFFER (buffer, 1);
+    return make_number (BUF_Z (XBUFFER (buffer)) - BUF_BEG (XBUFFER (buffer)));
+  }
 }
 
 DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0,