[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: List of buffers under version control?
From: |
John Mastro |
Subject: |
Re: List of buffers under version control? |
Date: |
Thu, 28 Jul 2016 14:14:50 -0700 |
Rolf Ade <rolf@pointsman.de> wrote:
> 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))
>
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)
> 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).
Not sure if it makes a difference for your use case, but
`save-some-buffers' does ask for confirmation before saving each buffer.
John
- 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, 2016/07/28
- Re: List of buffers under version control?,
John Mastro <=
- 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