(defvar org-maint-emacs-dir "~/src/emacs/emacs/") (defvar org-maint-org-dir "~/src/emacs/org-mode-devel/") (defun org-maint-apply-emacs-commit (commit &optional apply) "Apply COMMIT from `org-maint-emacs-dir' to `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 org-maint-org-dir org-maint-emacs-dir) (user-error "Need to set org-maint-org-dir and org-maint-emacs-dir")) (with-temp-buffer (let ((default-directory org-maint-emacs-dir)) (call-process "git" nil t nil "format-patch" "--stdout" (format "%s^..%s" commit commit) "--" "lisp/org")) (let ((default-directory org-maint-org-dir)) (call-process-region (point-min) (point-max) "git" nil t nil (if apply "apply" "am") "-p3" "--directory=lisp/")))) (defun org-maint-insert-emacs-commit-info (commit) "Insert information about COMMIT in `org-maint-emacs-dir'." (interactive "sCommit: ") (let ((default-directory org-maint-emacs-dir)) (call-process "git" nil t nil "show" "-s" "--format=%b%n%s%n%H%n%an%n%cd" commit))) (defun org-maint-rev-from-next-item () (save-excursion (or (and (re-search-forward "- \\[[ X]\\] \\([A-z0-9]\\{40\\}\\)") (match-string-no-properties 1)) (user-error "Next revision item not found"))))