diff options
-rw-r--r-- | org-maint.el | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/org-maint.el b/org-maint.el new file mode 100644 index 0000000..0d7e8b6 --- /dev/null +++ b/org-maint.el @@ -0,0 +1,33 @@ +(defvar km/org-maint-emacs-dir "~/src/emacs/emacs/") +(defvar km/org-maint-org-dir "~/src/emacs/org-mode-devel/") + +(defun km/org-maint-apply-emacs-commit (commit &optional apply) + "Apply COMMIT from `km/org-maint-emacs-dir' to `km/org-maint-org-dir'. +If APPLY is non-nil, use 'git apply' instead of 'git am'." + (interactive (list (or (and (use-region-p) + (buffer-substring-no-properties + (region-beginning) (region-end))) + (magit-commit-at-point) + (read-string "Emacs commit: ")) + current-prefix-arg)) + (unless (and km/org-maint-org-dir km/org-maint-emacs-dir) + (user-error "Need to set km/org-maint-org-dir and km/org-maint-emacs-dir")) + (with-temp-buffer + (let ((default-directory km/org-maint-emacs-dir)) + (call-process "git" nil t nil + "format-patch" "--stdout" + (format "%s^..%s" commit commit) + "--" "lisp/org")) + (let ((default-directory km/org-maint-org-dir)) + (call-process-region (point-min) (point-max) + "git" nil t nil + (if apply "apply" "am") + "-p3" "--directory=lisp/")))) + +(defun km/org-maint-insert-emacs-commit-info (commit) + "Insert information about COMMIT in `km/org-maint-emacs-dir'." + (interactive "sCommit: ") + (let ((default-directory km/org-maint-emacs-dir)) + (call-process "git" nil t nil + "show" "-s" "--format=%b%n%s%n%H%n%an%n%cd" + commit))) |