From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: List of buffers under version control? Date: Thu, 28 Jul 2016 14:14:50 -0700 Message-ID: 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; charset=UTF-8 X-Trace: ger.gmane.org 1469740554 16376 80.91.229.3 (28 Jul 2016 21:15:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2016 21:15:54 +0000 (UTC) Cc: Rolf Ade To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 28 23:15:54 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 1bSseo-0001Qn-0A for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Jul 2016 23:15:54 +0200 Original-Received: from localhost ([::1]:55705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSseh-0005Wi-Oj for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Jul 2016 17:15:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSse7-0005VR-89 for help-gnu-emacs@gnu.org; Thu, 28 Jul 2016 17:15:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSse6-0007lH-5m for help-gnu-emacs@gnu.org; Thu, 28 Jul 2016 17:15:11 -0400 Original-Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:34059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSse6-0007l5-1M for help-gnu-emacs@gnu.org; Thu, 28 Jul 2016 17:15:10 -0400 Original-Received: by mail-qk0-x22e.google.com with SMTP id o67so74582698qke.1 for ; Thu, 28 Jul 2016 14:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MLEXEZoxAumiq9IHQoQ1BBVM1CnENF4dLwCTZ3poZhE=; b=vIIl7rCbPWriZ9U3XjtThyjDKA/od6K0rVbfHkWjYy4EQEMvkcYorsgEPUrm9NlYGV UJGQjXYIHP/93i19VQKaF6ItA3QZPI4r6OdtSfWwwjLiF6l36322S47nwZjIP9QgSE41 iu+mpxt5ATVZp32A0cWjJXTJbb4aM8C+YN/otsTVjuaQiqUO9NpxWWkKuLZ1J1SSg8dP REmFL0zh1lyVN170eJVTgLQkIj73tnbY9n5qNwoo0v+eY6H/C+zEIXYVb9B5rovmHxln Ir/7yyEJZdjE2bBaSNTLz/3zVg4ga5wmguyCj9ySD1x+2n67lQeeJDioOkmJapAd+0er 7Qfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MLEXEZoxAumiq9IHQoQ1BBVM1CnENF4dLwCTZ3poZhE=; b=PhuSMGXt5rTsnUzqFQUr9j+SKOMhF+xwyO64qVhNToXlvYMYOM0fUqsQ7H9zQS7G7l PwMv3eEPWunZenWVtf7tUOhV8IkL5qQE5Z0DiW3SFNKttInnO494tzx/+hoP36o/k2zG J/P6/GVa0bFr5y4OYmWnPQ5sH8ZL7FNogw4zYvbA0Q68JVCX7tlif5OQYjmV4Dnx59lf kNhcyU1SxNEllijy1QujVsQrvXQ1L6rqxJdrzJ/R7nb9YKzfjw1Sj+1R+XbpsV7m5551 ZjtobYGBrK+prCgkaY86wp3YwRniDmijPwMBVGh4GnyuH6CNUxwcMUNWeXAESRYJDMqA felQ== X-Gm-Message-State: AEkoouu6edhU9CxXATe//GRTeW+fZNgny3sfzVQWSx9LnddmSuOvXRumO+5pkLHyet65oKeAweIFUl/4tUhjtg== X-Received: by 10.55.108.2 with SMTP id h2mr44593967qkc.202.1469740509467; Thu, 28 Jul 2016 14:15:09 -0700 (PDT) Original-Received: by 10.237.33.46 with HTTP; Thu, 28 Jul 2016 14:14:50 -0700 (PDT) In-Reply-To: <87k2g5v5nk.fsf@linux-qg7d.fritz.box> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::22e 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:110985 Archived-At: Rolf Ade 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