all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rolf Ade <rolf@pointsman.de>
To: help-gnu-emacs@gnu.org
Subject: Re: List of buffers under version control?
Date: Fri, 29 Jul 2016 00:27:07 +0200	[thread overview]
Message-ID: <877fc5v1ok.fsf@linux-qg7d.fritz.box> (raw)
In-Reply-To: mailman.2253.1469741176.26859.help-gnu-emacs@gnu.org


Drew Adams <drew.adams@oracle.com> 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'?


  parent reply	other threads:[~2016-07-28 22:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  0:03 List of buffers under version control? Rolf Ade
2016-07-28  4:05 ` Rusi
2016-07-28 19:31   ` Rolf Ade
2016-07-28 19:52     ` John Mastro
2016-07-28 19:58       ` John Mastro
2016-07-28 19:56     ` Marcin Borkowski
     [not found]     ` <mailman.2241.1469735551.26859.help-gnu-emacs@gnu.org>
2016-07-28 21:01       ` Rolf Ade
2016-07-28 21:14         ` John Mastro
2016-07-28 21:25           ` Drew Adams
     [not found]           ` <mailman.2253.1469741176.26859.help-gnu-emacs@gnu.org>
2016-07-28 22:27             ` Rolf Ade [this message]
     [not found]         ` <mailman.2252.1469740513.26859.help-gnu-emacs@gnu.org>
2016-07-28 21:52           ` Rolf Ade
2016-07-29  1:42         ` Stefan Monnier
2016-07-28  5:12 ` Yuri Khan
     [not found] ` <mailman.2177.1469682795.26859.help-gnu-emacs@gnu.org>
2016-07-28 19:31   ` Rolf Ade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fc5v1ok.fsf@linux-qg7d.fritz.box \
    --to=rolf@pointsman.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.