unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Rolf Ade <rolf@pointsman.de>
To: help-gnu-emacs@gnu.org
Subject: Re: List of buffers under version control?
Date: Thu, 28 Jul 2016 21:31:26 +0200	[thread overview]
Message-ID: <87r3adv9td.fsf@linux-qg7d.fritz.box> (raw)
In-Reply-To: mailman.2177.1469682795.26859.help-gnu-emacs@gnu.org


Yuri Khan <yuri.v.khan@gmail.com> writes:
> On Thu, Jul 28, 2016 at 7:03 AM, Rolf Ade <rolf@pointsman.de> wrote:
>
>> I often edit files in emacs, that are under version control. It should
>> not, but it happens, that I haven#t save-buffer some buffer, while
>> check-in on the cmd line.
>
> Normally, when staging a commit, for each unsaved file, you will see a
> lock (.#<filename>) and possibly a recovery file (#<filename>#) in the
> same directory. This is your signal that not all files are saved. As
> soon as you save the file, its lock and recovery file disappear.

Well, this proposes an enlargement of my work-flow. Do one step more:
run ls and look at the output, before I check-in.

Still, a simple ls would not be sufficent. Often, there are a few
modified files spread over sub-directories. A `find -name '#*'` instead
of a simple ls could help, but has other drawbacks. Most important, this
would only work if I check-in only in the root directory of the version
controled sub tree, which is I step, that is currently not needed. Yes,
a bit shell scripting within the wrapper around the scm command line
tool could find the root of the source tree and do the find there. But
even then other open and modified files out of that sub tree, that are
not under version control (temporary input or output files, for example)
would give false positives.

With emacsclient -e I'm able to ask the running emacs. Something like
this

(loop for buffer in (buffer-list)
      until (if (buffer-file-name buffer)
                (buffer-modified-p buffer)
              nil)
      finally return (if (buffer-modified-p buffer)
                         1
                       0))

is a skeleton of what I want. The missing piece is that I only want to
look at buffers under version control, not on all buffers, that are
visiting a file, as above.

In other words, I'm searching for a (buffer-is-under-version-control-p
buffer) function. How could that be done?


      parent reply	other threads:[~2016-07-28 19:31 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
     [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 [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87r3adv9td.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).