help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Number of open buffers?


From: David Kastrup
Subject: Re: Number of open buffers?
Date: 20 Nov 2003 23:14:30 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

lawrence mitchell <address@hidden> writes:

> David Kastrup wrote:
> 
> [...]
> 
> > (defun get-number-of-file-buffers ()
> >   (interactive)
> >   (let ((num 0))
> >     (dolist (buf (buffer-list) num)
> >       (when (buffer-file-name buf)
> >           (setq num (1+ num))))))
> 
> Assuming cl is loaded:
> 
> (defun get-number-of-file-buffers ()
>   (loop for b in (buffer-list) count (buffer-file-name b)))
> 

Wel, if we want to squeeze characters of source, we can do so without
cl, too.

(defun get-number-of-file-buffers ()
  (apply '+ (mapcar (lambda(x)(if(buffer-file-name x)1 0)) (buffer-list))))



-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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