Skip to content

Instantly share code, notes, and snippets.

@apconole
Created November 9, 2015 21:07
Show Gist options
  • Save apconole/c6e5c52766e5bd352686 to your computer and use it in GitHub Desktop.
Save apconole/c6e5c52766e5bd352686 to your computer and use it in GitHub Desktop.
(defun save-gnus-buffer-temp-article-saver (&optional filename overwrite)
"Save"
(setq filename "/tmp/somepatch.patch")
(with-current-buffer gnus-save-article-buffer
(save-excursion
(save-restriction
(widen)
(when (file-exists-p filename)
(delete-file filename))
(gnus-output-to-file filename))))
filename)
(defun save-gnus-buffer-temp (&optional arg)
"try to save the gnus buffer to a temp file"
(interactive)
(let ((gnus-default-article-saver 'save-gnus-buffer-temp-article-saver))
(gnus-summary-save-article arg)))
(setq default-grab-and-patch-repository "/home/aconole/git/linux/")
(defun grab-and-patch-mail ()
"Grab mail and patch in the directory"
(interactive)
(let ((default-directory default-grab-and-patch-repository)
(check-script-path (concat default-directory "/scripts/checkpatch.pl")))
(save-gnus-buffer-temp)
(let ((am-exit-code (call-process "git" nil nil nil "am" "/tmp/somepatch.patch"))
(check-patch-exit-code "FAIL"))
(when (and (file-exists-p check-script-path)
(file-exists-p "/tmp/somepatch.patch"))
(setq check-patch-exit-code (call-process check-script-path nil nil nil "/tmp/somepatch.patch")))
(message "CheckPatch: %s, am: %s" check-patch-exit-code am-exit-code)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment