[mew-int 2938] (no subject)
diogofsr at example.com
diogofsr at example.com
Wed Nov 10 17:18:40 JST 2010
>From a9476daf6a6639370ca5465ca1ac4dc2adc6a84f Mon Sep 17 00:00:00 2001
From: Diogo F. S. Ramos <diogofsr at example.com>
Subject: [PATCH] Inserts the contents of a git's format-patch file in a
draft.
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The command to do so is `mew-git-send-patch'.
It's very naive and simple. It doesn't even tries to ensure this is an
actual patch.
---
I'm playing around with the idea of using mew to send git's
format-patch.
This is the first attempt to do that. Hope someone finds this
useful. Any comment will be very much appreciated.
Just to note, this very patch was make using itself. :D
mew-git.el | 34 ++++++++++++++++++++++++++++++++++
mew.el | 1 +
2 files changed, 35 insertions(+), 0 deletions(-)
create mode 100644 mew-git.el
diff --git a/mew-git.el b/mew-git.el
new file mode 100644
index 0000000..382daca
--- /dev/null
+++ b/mew-git.el
@@ -0,0 +1,34 @@
+;;; mew-git.el --- Prepare a git's format-patch draft
+
+;; Copyright (C) 2010 Diogo F. S. Ramos
+
+;; Author: Diogo F. S. Ramos <diogofsr at example.com>
+
+(defun mew-git-send-patch (file-name &optional to cc subject newsgroups)
+ "Prepare a draft from a format-patch file made by git"
+ (interactive "fgit's format-patch: ")
+ (let ((draft (mew-folder-new-message mew-draft-folder))
+ asked)
+ (if (and (mew-summary-physical-folder)
+ (mew-folder-nntpp (mew-summary-physical-folder)))
+ (if (null newsgroups) (setq newsgroups ""))
+ (when (and mew-ask-to (null to))
+ (setq to (mew-input-address (concat mew-to: " ")))
+ (setq asked t))
+ (when (and mew-ask-cc (null cc))
+ (setq cc (mew-input-address (concat mew-cc: " ")))
+ (setq asked t)))
+ (mew-current-set-window-config)
+ (mew-window-configure 'draft)
+ (mew-summary-prepare-draft
+ (mew-draft-find-and-switch draft)
+ (mew-delete-directory-recursively (mew-attachdir draft))
+ (mew-git-retrieve-header file-name)
+ (mew-draft-mode)
+ (run-hooks 'mew-draft-mode-newdraft-hook))))
+
+(defun mew-git-retrieve-header (file-name)
+ (insert "To: \n")
+ (insert-file-contents file-name)
+ (goto-char (point-min))
+ (search-forward ": " nil t))
\ No newline at end of file
diff --git a/mew.el b/mew.el
index f9d4797..0f3ca2f 100644
--- a/mew.el
+++ b/mew.el
@@ -733,6 +733,7 @@ Mew remain, so you can resume with buffer operations."
(require 'mew-imap2)
(require 'mew-config)
(require 'mew-auth)
+(require 'mew-git)
(eval-when-compile
(if (mew-which-el "timer")
--
1.7.1
--
Diogo F. S. Ramos
More information about the Mew-int
mailing list