From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolf Ade Newsgroups: gmane.emacs.help Subject: Re: List of buffers under version control? Date: Fri, 29 Jul 2016 00:27:07 +0200 Organization: Me Message-ID: <877fc5v1ok.fsf@linux-qg7d.fritz.box> References: <877fc6wrv7.fsf@linux-qg7d.fritz.box> <006fed39-43f3-40aa-a72b-c736ba9bf86c@googlegroups.com> <87shutv9tr.fsf@linux-qg7d.fritz.box> <87k2g5v5nk.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1469745036 20353 80.91.229.3 (28 Jul 2016 22:30:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2016 22:30:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 29 00:30:36 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bStp5-0007zn-2B for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Jul 2016 00:30:35 +0200 Original-Received: from localhost ([::1]:56039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bStoy-0001Ap-JA for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Jul 2016 18:30:28 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-X-Trace: individual.net PkbBLWDuRS6QdjaadeSZUAMRGlSqi1CtJhnLeSMVo60LhhxEQ= Cancel-Lock: sha1:tzlBHLmWnEZEBVXl9FphlEmP3OE= sha1:R2ZXgcgdND74KxKUNgQm5SqLk40= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:218679 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110990 Archived-At: Drew Adams writes: >> Glad it helps. You could do something like this to avoid repeating the >> calls to `vc-backend' and `buffer-modified-p': >> >> (if (loop for buffer in (buffer-list) >> thereis (and (vc-backend (buffer-file-name buffer)) >> (buffer-modified-p buffer))) >> 1 >> 0) > > And are you using this just as a predicate (Boolean test)? No, or well, yes, but not in the context of other emacs lisp code. The result value is used by some sh wrapper code around a command line tool. So, John Mastro was exactly on track. > If so, just: > > (loop for buffer in (buffer-list) > thereis (and (vc-backend (buffer-file-name buffer)) > (buffer-modified-p buffer))) Yes. I'm certain, John is aware. > or > > (cl-some (lambda (b) > (and (vc-backend (buffer-file-name b)) > (buffer-modified-p b))) > (buffer-list)) Now, this is still some characters less, more compact, yes. Since I wasn't aware of of `some' up to now ... I wonder: Is there something, that is easily done with `some' that could not be done (at least well) with `loop'?