From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: buffer-list and desktop Date: Wed, 10 Nov 2004 23:48:06 +0100 Organization: Organization?!? Message-ID: References: <2vf8jiF2krb46U1@uni-berlin.de> <2vfhn9F2kl6jmU1@uni-berlin.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1100177504 11972 80.91.229.6 (11 Nov 2004 12:51:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Nov 2004 12:51:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 10 23:51:33 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CS1JN-0000Vo-00 for ; Wed, 10 Nov 2004 23:51:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CS1Rq-0007zD-Rt for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Nov 2004 18:00:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-X-Trace: news.uni-berlin.de Xdq4UIR0+rgQ0H3Tr2N4KwwOqNTrgbahK/934omoiw8n/ocufa X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:r00/5I1G1ld4VEbJvx+EzB+jC28= Original-Xref: shelby.stanford.edu gnu.emacs.help:126493 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21892 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21892 Jesper Harder writes: > Kevin Rodgers writes: > >> Gotta get used to using with-current-buffer: >> >> (defun desktop-list-buffers () >> "Return the list of buffers that `desktop-save' would save." >> (nreverse >> (apply 'nconc >> (mapcar (lambda (buffer) >> (with-current-buffer buffer >> (if (desktop-save-buffer-p (buffer-file-name) >> (buffer-name) >> major-mode) >> (list buffer)))) >> (buffer-list))))) > > Or if you don't mind requiring cl: > > (delete-if-not > (lambda (buf) > (desktop-save-buffer-p (buffer-file-name buf) (buffer-name buf) > (buffer-local-value 'major-mode buf))) > (buffer-list)) Still slow because of one bind/unbind per iteration. If you want to do it that way, anyway, you could avoid cl by using (delq nil (mapcar (lambda (buf) (and (desktop-save-buffer-p ...) buf)) (buffer-list))) with hardly more effort. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum