Gnus development mailing list
 help / color / mirror / Atom feed
From: David Engster <deng@randomsample.de>
To: Daiki Ueno <ueno@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,  ding@gnus.org
Subject: Re: git am/send-email support?
Date: Thu, 29 Jan 2015 20:53:51 +0100	[thread overview]
Message-ID: <87386t9xdc.fsf@randomsample.de> (raw)
In-Reply-To: <m3k306ot1m.fsf-ueno@gnu.org> (Daiki Ueno's message of "Thu, 29 Jan 2015 18:05:57 +0900")

Daiki Ueno writes:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Daiki Ueno <ueno@gnu.org> writes:
>>
>>> Is there any Gnus command(s) to interact with git, particularly applying
>>> a patch from an article buffer and composing/sending a patch by email?
>>
>> I haven't seen anything in particular.  I just use the `|' command to
>> pipe stuff into "patch"...
>
> Thanks, I haven't thought of it.  But isn't it a bit cumbersome to
> manually specify the path of a git working directory (than being asked
> interactively)?
>
> I'd appreciate if anyone could provide well-tested handy little snippets
> for those operations :-)

Well, here's mine:

(defvar DE-gnus-git-directories
      '(("cedet" "~/cedet-git")
        ("emacs" "~/emacs-git"))
  "Name and directory for git projects.")

(defvar DE-gnus-git-last-dir nil)

(defun DE-gnus-apply-git-patch ()
  "Run git-am on currently visible mail or posting."
  (interactive)
  (when (null gnus-article-buffer)
    (error "No opened article buffer."))
  (with-current-buffer gnus-article-buffer
    (let* ((project
	    (completing-read 
	     "Choose project: "
	     (mapcar 'car DE-gnus-git-directories)
	     nil t DE-gnus-git-last-dir))
	   (output (get-buffer-create  "*git output*"))
	   (default-directory (file-name-as-directory 
			       (expand-file-name
				(cadr (assoc project DE-gnus-git-directories))))))
      (setq DE-gnus-git-last-dir project)
      (if (zerop
	   (shell-command-on-region
	    (point-min) (point-max)
	    (format "git am")
	    output))
	  (message "Patch(es) applied. See *git output* for details.")
	(message "There was an error running git.")
	(switch-to-buffer output)))))

-David



  reply	other threads:[~2015-01-29 19:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  3:55 Daiki Ueno
2015-01-29  2:23 ` Lars Ingebrigtsen
2015-01-29  9:05   ` Daiki Ueno
2015-01-29 19:53     ` David Engster [this message]
2015-02-02  8:11       ` Daiki Ueno
2015-01-29 23:37     ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=87386t9xdc.fsf@randomsample.de \
    --to=deng@randomsample.de \
    --cc=ding@gnus.org \
    --cc=larsi@gnus.org \
    --cc=ueno@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 NNTP newsgroup(s).