created an emacs plugin

This commit is contained in:
Yann Esposito (Yogsototh) 2018-08-29 17:32:10 +02:00
parent 47d8f2b194
commit ff69ef9a92
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
3 changed files with 77 additions and 32 deletions

View file

@ -0,0 +1,4 @@
(define-package
"gpm-review"
"0.0.1"
"Handle code review for gpm (git package manager)")

View file

@ -0,0 +1,66 @@
;; gpm-review.el -- review with org-capture with gpm (git project manager)
;;
;; Copyright (c) 2018 Yann Esposito
;;
;; Author: Yann Esposito <yann.esposito@gmail.com>
;; Keywords: git
;; Version: 0.0.1
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;; Provide elisp functions in emacs to help code review within
;; gpm (git project manager)
;;; Code:
(require 'url)
(defun get-prop (prop-name)
(org-with-point-at org-babel-current-src-block-location
(org-entry-get nil prop-name t)))
(defun gen-review-file-name ()
(let* ((branch (get-prop "BRANCH"))
(reviewer (get-prop "REVIEWER"))
(review-file-name ))
(concat branch "-" reviewer ".org")))
(defun start-review ()
"to be called at the beginning of the review"
(let* ((review-file-name (gen-review-file-name))
(review-dir "~/.reviews/")
(local-review (concat "file:../reviews/" review-file-name))
(global-review (concat review-dir review-file-name)))
(url-copy-file local-review global-review)
(setq org-capture-templates
`(("c" "Change requested" entry (file+headline global-review)
"* CHANGE_REQUESTED %?\n %i\n %a")
("q" "question" entry (file+headline global-review)
"* QUESTION %?\n %i\n %a")
("r" "refused" entry (file+headline global-review)
"* REFUSED %?\n %i\n %a")))
(setq org-default-notes-file global-review)))
(defun end-review ()
"to be call when the reviewer ends its review."
(let* ((review-file-name (gen-review-file-name))
(review-dir "~/.reviews/")
(local-review (concat "file:../reviews/" review-file-name))
(global-review (concat review-dir review-file-name)))
(url-copy-file global-review local-review)
(setq org-default-notes-file global-review)))
(provide 'gpm-review)
;;; gpm-review.el ends here

View file

@ -4,12 +4,13 @@
#+PROPERTY: ASSIGNEE
#+PROPERTY: REVIEWERS
#+PROPERTY: BRANCH
#+SEQ_TODO: FEEDBACK(f) TODO(t) STARTED(s) WAITING(w) LGTM(l) | DONE(d) CANCELLED(c) DEFERRED(f)
#+SEQ_TODO: REVIEW(r) | MERGED(m) ABORTED(a)
#+SEQ_TODO: ACCEPTED(l) CHANGE_REQUESTED(c) | REFUSED(r)
#+TODO: FEEDBACK(f) TODO(t) STARTED(s) WAITING(w) LGTM(l) | DONE(d) CANCELLED(c)
#+TODO: REVIEW(r) | MERGED(m) ABORTED(a)
#+TODO: ACCEPTED(l) CHANGE_REQUESTED(c) QUESTION(q) | REFUSED(r)
#+COLUMNS: %38ITEM(Details) %TAGS(Context) %7TODO(To Do) %8ASSIGNEE %5Effort(Time){:}
#+TAGS: bug(b) doc(d) ops(o)
#+STARTUP: content
#+STARTUP: latexpreview
This is an example on how to organize the issues. The basic usage is quite
simple, only use 3 status (todo, started, done)
@ -103,34 +104,8 @@ in =reviews=.
#+NAME: init-reviews
#+BEGIN_SRC emacs-lisp :results silent
(require 'url)
(defun get-prop (prop-name)
(org-with-point-at org-babel-current-src-block-location
(org-entry-get nil prop-name t)))
(defun gen-review-file-name ()
(let* ((branch (get-prop "BRANCH"))
(reviewer (get-prop "REVIEWER"))
(review-file-name ))
(concat branch "-" reviewer ".org")))
(defun start-review ()
"to be called at the beginning of the review"
(let* ((review-file-name (gen-review-file-name))
(review-dir "~/.reviews/")
(local-review (concat "file:../reviews/" review-file-name))
(global-review (concat review-dir review-file-name)))
(url-copy-file local-review global-review)
(setq org-default-notes-file global-review)))
(defun end-review ()
"to be call when the reviewer ends its review."
(let* ((review-file-name (gen-review-file-name))
(review-dir "~/.reviews/")
(local-review (concat "file:../reviews/" review-file-name))
(global-review (concat review-dir review-file-name)))
(url-copy-file global-review local-review)
(setq org-default-notes-file global-review)))
;; (load "../gpm-review-0.0.1/gpm-review.el")
(require 'gpm-review)
#+END_SRC
1. Start by using =C-c C-c= here.