Discussion:
git am/send-email support?
Daiki Ueno
2015-01-28 03:55:08 UTC
Permalink
Hello,

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'm pretty sure it was already written by someone, but I couldn't find
anything except magit-apply-mailbox, which seems to apply patches from
mbox or Maildir.

Thanks,
--
Daiki Ueno
Lars Ingebrigtsen
2015-01-29 02:23:51 UTC
Permalink
Post by Daiki Ueno
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"...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Daiki Ueno
2015-01-29 09:05:57 UTC
Permalink
Post by Lars Ingebrigtsen
Post by Daiki Ueno
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 :-)

Regards,
--
Daiki Ueno
David Engster
2015-01-29 19:53:51 UTC
Permalink
Post by Daiki Ueno
Post by Lars Ingebrigtsen
Post by Daiki Ueno
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
Daiki Ueno
2015-02-02 08:11:29 UTC
Permalink
Post by David Engster
(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."
Thank you, working nicely!
Post by David Engster
(setq gnus-summary-pipe-output-default-command "patch
--no-backup-if-mismatch -l -f -d ~/pgnus/lisp")
And I just edit the path to point at the right thing I want to patch,
which varies from time to time.
This looks also useful, thanks. Maybe I could set the directory path
through a group parameter to fully automate it.

Regards,
--
Daiki Ueno

Lars Ingebrigtsen
2015-01-29 23:37:48 UTC
Permalink
Post by Daiki Ueno
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 have the following in my .gnus.el:

(setq gnus-summary-pipe-output-default-command "patch --no-backup-if-mismatch -l -f -d ~/pgnus/lisp")

And I just edit the path to point at the right thing I want to patch,
which varies from time to time.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Continue reading on narkive:
Loading...