[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: |
Thu, 28 Jul 2016 23:01:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
John Mastro <john.b.mastro@gmail.com> writes:
> Rolf Ade <rolf@pointsman.de> wrote:
>> Since emacs show me in the mode line of that buffers, that the file is
>> under version control, there must be a way with elisp to determine, if
>> the file shown in a buffer is under version control. How could that be
>> done?
>
> You could use `vc-backend', e.g. (vc-backend (buffer-file-name)).
Thank you. That was the missing bit.
Something like this is it:
(loop for buffer in (buffer-list)
until (if (vc-backend (buffer-file-name buffer))
(buffer-modified-p buffer))
finally return (if (and (buffer-modified-p buffer)
(vc-backend (buffer-file-name buffer)))
1
0))
> `save-some-buffers' accepts an argument PRED; you could also use
> `vc-backend' there:
Yes. This doesn't apply in my case, because I'm 'quering' emacs from
within a script with the help of emacsclient -e and want just a yes / no
answer (hence the 'un-lispish' return values). I just want to know, if
this is the case (and ask for confirmation, to give me a chance to look
at the thing, instead of just saving).
- List of buffers under version control?, Rolf Ade, 2016/07/27
- Re: List of buffers under version control?, Rusi, 2016/07/28
- Re: List of buffers under version control?, Rolf Ade, 2016/07/28
- Re: List of buffers under version control?, Marcin Borkowski, 2016/07/28
- Message not available
- Re: List of buffers under version control?,
Rolf Ade <=
- Re: List of buffers under version control?, John Mastro, 2016/07/28
- RE: List of buffers under version control?, Drew Adams, 2016/07/28
- Message not available
- Re: List of buffers under version control?, Rolf Ade, 2016/07/28
- Message not available
- Re: List of buffers under version control?, Rolf Ade, 2016/07/28
- Re: List of buffers under version control?, Stefan Monnier, 2016/07/28
Re: List of buffers under version control?, Yuri Khan, 2016/07/28
Message not available