discussion and development of piem
 help / color / mirror / code / Atom feed
blob 9b309dec14659f85f5ab80ffda8764df7624a6cb 2250 bytes (raw)
name: piem-edit-patch.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
;;; piem-edit-patch.el --- TODO  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  all contributors <piem@inbox.kyleam.com>

;; TODO

;;; Code:

(require 'piem)
(require 'piem-b4)                      ; not used yet

(define-derived-mode piem-edit-patch-mode nil "piem-edit-patch"
  "TODO"
  :group 'piem)

(defvar piem-edit-patch-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c C-c") #'piem-edit-patch-am)
    map)
  "TODO")

(defvar-local piem-edit-patch--coderepo nil)
(defvar-local piem-edit-patch--format nil)
(defvar-local piem-edit-patch--mid nil)

(defun piem-edit-patch-open (&optional entire-thread)
  (interactive "P")
  (if-let ((mid (or (piem-mid)
                     (user-error
                      "No message ID found for the current buffer")))
           (fn (if entire-thread
                   ;; NEEDSWORK: B4 isn't wired up, so caller would
                   ;; need to prune non-patch messages.
                   (run-hook-with-args-until-success
                    'piem-mid-to-thread-functions mid)
                 (run-hook-with-args-until-success
                  'piem-am-ready-mbox-functions))))
      (let ((coderepo (piem-inbox-coderepo))
            (format "mboxrd"))
        (when (member (cdr-safe fn) '("mbox" "mboxrd"))
          (setq format (cdr fn))
          (setq fn (car fn)))
        (with-current-buffer (get-buffer-create
                              (format "*piem-edit-patch-%s*" mid))
          (erase-buffer)
          (funcall fn)
          (unless (/= (point-max) 1)
            (error "Failed to generated mbox"))
          (goto-char (point-min))
          (piem-edit-patch-mode)
          (setq piem-edit-patch--coderepo coderepo)
          (setq piem-edit-patch--format format)
          (setq piem-edit-patch--mid mid)
          (pop-to-buffer (current-buffer))))
    (user-error "Do not know how to generate patch for current buffer")))

(defun piem-edit-patch-am (&optional toggle-worktree)
  (interactive "P")
  (piem-am (current-buffer)
           piem-edit-patch--format
           (piem-extract-mbox-info (current-buffer))
           piem-edit-patch--coderepo
           toggle-worktree))

;;; piem-edit-patch.el ends here
(provide 'piem-edit-patch)

debug log:

solving 9b309dec ...
found 9b309dec in https://inbox.kyleam.com/piem/87o85qfj62.fsf@kyleam.com/

applying [1/1] https://inbox.kyleam.com/piem/87o85qfj62.fsf@kyleam.com/
diff --git a/piem-edit-patch.el b/piem-edit-patch.el
new file mode 100644
index 00000000..9b309dec

Checking patch piem-edit-patch.el...
Applied patch piem-edit-patch.el cleanly.

index at:
100644 9b309dec14659f85f5ab80ffda8764df7624a6cb	piem-edit-patch.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/piem/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).