unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* single-command git commits
@ 2016-07-19  0:06 Eric Abrahamsen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2016-07-19  0:06 UTC (permalink / raw)
  To: help-gnu-emacs

I know one of you has a recipe for this...

I'm working on a long document in a single-file git repository (I know
there are probably better solutions). What I'd like to do is have a
single command that prompts me for a git commit message, and then
commits. The in-Emacs equivalent of:

git commit -a -m "(read-string \"Commit message: \")"

Yes, I could probably write a shell script, but I'd like to do it in
Emacs! The vc-* commands don't provide an immediately-obvious way to do
this. I have magit and projectile installed, and would be happy to use
their commands, but again haven't found anything obvious. I'll write
something myself, but does anyone have a nice foundation for building
this on?

Free beers in return...

E




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
       [not found] <mailman.1664.1468886830.26859.help-gnu-emacs@gnu.org>
@ 2016-07-19  0:33 ` Emanuel Berg
  2016-07-19  0:44   ` Eric Abrahamsen
       [not found]   ` <mailman.1666.1468889079.26859.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg @ 2016-07-19  0:33 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric(a)ericabrahamsen.net>
writes:

> I'm working on a long document in
> a single-file git repository (I know there
> are probably better solutions). What I'd like
> to do is have a single command that prompts
> me for a git commit message, and then
> commits. The in-Emacs equivalent of:
>
> git commit -a -m "(read-string \"Commit
> message: \")"

(defun git-commit (msg)
  (interactive "sCommit message: ")
  (shell-command
   (format "git commit -a -m %s" msg) ))

> Free beers in return...

Emanuel Berg
Dalgatan 8
752 18 Uppsala
Sweden

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
  2016-07-19  0:33 ` single-command git commits Emanuel Berg
@ 2016-07-19  0:44   ` Eric Abrahamsen
  2016-07-19  0:54     ` Dmitry Gutov
       [not found]     ` <mailman.1667.1468889678.26859.help-gnu-emacs@gnu.org>
       [not found]   ` <mailman.1666.1468889079.26859.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2016-07-19  0:44 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Eric Abrahamsen <eric(a)ericabrahamsen.net>
> writes:
>
>> I'm working on a long document in
>> a single-file git repository (I know there
>> are probably better solutions). What I'd like
>> to do is have a single command that prompts
>> me for a git commit message, and then
>> commits. The in-Emacs equivalent of:
>>
>> git commit -a -m "(read-string \"Commit
>> message: \")"
>
> (defun git-commit (msg)
>   (interactive "sCommit message: ")
>   (shell-command
>    (format "git commit -a -m %s" msg) ))

Yes, when I said "I could probably write a shell script..." that was
meant to include "or `shell-command'" (this is where I start backing out
of my free beer promise). I'd like to use the highest-level vc function
available to me, ideally something above the level of git-awareness!

E




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
  2016-07-19  0:44   ` Eric Abrahamsen
@ 2016-07-19  0:54     ` Dmitry Gutov
  2016-07-19  1:02       ` Eric Abrahamsen
       [not found]     ` <mailman.1667.1468889678.26859.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2016-07-19  0:54 UTC (permalink / raw)
  To: Eric Abrahamsen, help-gnu-emacs

On 07/19/2016 03:44 AM, Eric Abrahamsen wrote:
> I'd like to use the highest-level vc function
> available to me,

vc-git-checkin?

> ideally something above the level of git-awareness!

(vc-call-backend backend 'checkin files comment)




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
       [not found]   ` <mailman.1666.1468889079.26859.help-gnu-emacs@gnu.org>
@ 2016-07-19  1:00     ` Emanuel Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2016-07-19  1:00 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen wrote:

> Yes, when I said "I could probably write
> a shell script..." that was meant to include
> "or `shell-command'"

I agree, you probably could :)

> I'd like to use the highest-level vc function
> available to me, ideally something above the
> level of git-awareness!

All functions are on the same level, and the
point of invocation must be aware of the git
binary (I have it /usr/bin/git).

Because you only want an interface to a shell
command, `shell-command' would be the natural
way but I suppose `call-process' (or
`call-process-shell-command') would do it?

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
  2016-07-19  0:54     ` Dmitry Gutov
@ 2016-07-19  1:02       ` Eric Abrahamsen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2016-07-19  1:02 UTC (permalink / raw)
  To: help-gnu-emacs

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 07/19/2016 03:44 AM, Eric Abrahamsen wrote:
>> I'd like to use the highest-level vc function
>> available to me,
>
> vc-git-checkin?
>
>> ideally something above the level of git-awareness!
>
> (vc-call-backend backend 'checkin files comment)

That's what I was looking for. My version control knowledge starts with
git, I wasn't looking for the word "checkin". Thanks!

E




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: single-command git commits
       [not found]     ` <mailman.1667.1468889678.26859.help-gnu-emacs@gnu.org>
@ 2016-07-19  1:04       ` Emanuel Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2016-07-19  1:04 UTC (permalink / raw)
  To: help-gnu-emacs

Dmitry Gutov wrote:

>> I'd like to use the highest-level vc
>> function available to me,
>
> vc-git-checkin?

That's highER-level function!

Perhaps if a higher-level function accepts
a higher-level function, then that is even
higher tho...

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-19  1:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1664.1468886830.26859.help-gnu-emacs@gnu.org>
2016-07-19  0:33 ` single-command git commits Emanuel Berg
2016-07-19  0:44   ` Eric Abrahamsen
2016-07-19  0:54     ` Dmitry Gutov
2016-07-19  1:02       ` Eric Abrahamsen
     [not found]     ` <mailman.1667.1468889678.26859.help-gnu-emacs@gnu.org>
2016-07-19  1:04       ` Emanuel Berg
     [not found]   ` <mailman.1666.1468889079.26859.help-gnu-emacs@gnu.org>
2016-07-19  1:00     ` Emanuel Berg
2016-07-19  0:06 Eric Abrahamsen

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).