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

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

Re: List of buffers under version control?


From: Rolf Ade
Subject: Re: List of buffers under version control?
Date: Fri, 29 Jul 2016 00:27:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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'?


reply via email to

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