~niklaseklund/egerrit

ref: 2f5b35f76a37ae64b21bd6d3689950779c1762d3 egerrit/egerrit-conversation.el -rw-r--r-- 24.6 KiB
2f5b35f7Niklas Eklund Add command to publish draft comments 3 months ago
                                                                                
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
;;; egerrit-conversation.el --- Conversation for egerrit -*- lexical-binding: t; -*-

;; Copyright (C) 2022  Free Software Foundation, Inc.

;; This file is not part of GNU Emacs.

;; 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:

;; This library provides the conversation for `egerrit'.

;;; Code:

;;;; Requirements

(require 'diff-mode)
(require 'egerrit-core)
(require 'egerrit-datastructures)
(require 'subr-x)
(require 'text-property-search)

(declare-function egerrit--read-comments "egerrit")
(declare-function egerrit--generate-comments-buffer "egerrit")
(declare-function egerrit--diff-hunk-line-offset "egerrit")
(declare-function egerrit-kill-comment "egerrit")
(declare-function egerrit-open-info "egerrit")
(declare-function egerrit-quit-review-or-feedback "egerrit")
(declare-function egerrit-create-comment "egerrit")
(declare-function egerrit-publish-review-label "egerrit")
(declare-function egerrit-download-change "egerrit")
(declare-function egerrit-publish-comments "egerrit-comment")
(declare-function egerrit-publish-draft-comments "egerrit-comment")
(declare-function egerrit-yank-url "egerrit")
(declare-function egerrit--create-range "egerrit")

(defvar egerrit-comment-block-list)
(defvar egerrit--current-entities)
(defvar egerrit-commit-message-source-code-function)

;;;; Variables

(defcustom egerrit-gerrit-conversation-context 5
  "A variable which determines lines of context in conversations."
  :type 'int
  :group 'egerrit)

(defcustom egerrit-comment-formatter #'ignore
  "A function that takes no argument."
  :type 'function
  :group 'egerrit)

(defcustom egerrit-status-formatter #'ignore
  "A function that takes no argument."
  :type 'function
  :group 'egerrit)

;;;;; Private

(defvar egerrit--conversation-mode nil
  "Set to either review or feedback.")

(defvar egerrit--current-conversation nil
  "Variable that contain an `egerrit-conversation'.")

;;;; Functions

(defun egerrit-get-conversations (changeid)
  "Return a list of conversations on CHANGEID."
  (let* ((json-comments (egerrit--read-comments changeid)))
    (thread-last json-comments
                 (seq-map #'egerrit--remove-blocked-comments)
                 (seq-map #'egerrit--group-conversation-comments)
                 (seq-map #'egerrit--create-conversations)
                 (flatten-list))))

(defun egerrit-visit-conversation-source-code (&optional suppress-commit-message)
  "Visit conversation source code.

Optionally SUPPRESS-COMMIT-MESSAGE."
  (interactive)
  (let* ((conversation-id (plist-get (text-properties-at (point)) 'conversation-id))
         (conversation (seq-find (lambda (it) (string= (egerrit--conversation-id it) conversation-id)) egerrit--current-entities))
         (file (egerrit--conversation-file conversation))
         (range (egerrit--conversation-range conversation)))
    (if (string= "/COMMIT_MSG" file)
        (unless suppress-commit-message
          (funcall egerrit-commit-message-source-code-function)
          nil)
      (if (not (file-exists-p file))
          (progn
            (message "Source file %s doesn't exist" file)
            nil)
        (find-file-other-window file)
        (goto-char (point-min))
        (forward-line (1- (egerrit--range-start-line range)))
        (move-to-column (egerrit--range-start-character range))
        t))))

;;;; Commands

;;;###autoload
(defun egerrit-focus-on-conversation ()
  "Put focus on current conversation."
  (interactive)
  (remove-overlays (point-min) (point-max))
  (when-let* ((start (previous-single-property-change (point) 'conversation))
              (ov (make-overlay (point-min) start)))
    (overlay-put ov 'face 'egerrit-context-highlight-out-of-focus-face))
  (when-let* ((end (next-single-property-change (point) 'conversation))
              (ov (make-overlay end (point-max))))
    (overlay-put ov 'face 'egerrit-context-highlight-out-of-focus-face)))

;;;###autoload
(defun egerrit-next-conversation ()
  "Navigate to the next conversation."
  (interactive)
  (if-let* ((conversation-end
             (save-excursion
               (prop-match-end (text-property-search-forward 'conversation t t))))
            (next-comments
             (save-excursion
               (goto-char conversation-end)
               (text-property-search-forward 'comments t t))))
      (progn
        (goto-char (prop-match-beginning next-comments))
        (recenter)
        (if (eq egerrit--conversation-mode 'review)
            (progn
              (egerrit-visit-conversation)
              (other-window 1))
          (when (egerrit-visit-conversation-source-code t)
            (other-window 1)))
        t)
    (message "No next comment")
    nil))

;;;###autoload
(defun egerrit-previous-conversation ()
  "Navigate to the previous conversation."
  (interactive)
  (if-let* ((conversation-begin
             (save-excursion
               (prop-match-beginning (text-property-search-backward 'conversation t t))))
            (previous-comments
             (save-excursion
               (goto-char conversation-begin)
               (text-property-search-backward 'comments t t))))
      (progn
        (goto-char (prop-match-beginning previous-comments))
        (recenter)
        (if (eq egerrit--conversation-mode 'review)
            (progn
              (egerrit-visit-conversation)
              (other-window 1))
          (when (egerrit-visit-conversation-source-code t)
            (other-window 1)))
        t)
    (message "No previous comment")
    nil))

;;;###autoload
(defun egerrit-visit-conversation ()
  "Visit conversation at point."
  (interactive)
  (let* ((conversation-id (symbol-name (plist-get (text-properties-at (point)) 'conversation-id)))
         (conversation (seq-find (lambda (it) (string= (egerrit--conversation-id it) conversation-id)) egerrit--current-entities)))
    (if (eq egerrit--conversation-mode 'feedback)
        (egerrit-visit-conversation-source-code)
      (select-window (get-buffer-window (egerrit-get-buffer "egerrit-revision-diff")))
      (goto-char (seq-elt (egerrit-region conversation) 0))
      (set-mark (point))
      (goto-char (seq-elt (egerrit--conversation-region conversation) 1))
      (activate-mark)
      (recenter-top-bottom))))

;;;###autoload
(defun egerrit-toggle-conversation-status ()
  "Toggle status on conversation at point."
  (interactive)
  (let* ((id (plist-get (text-properties-at (point)) 'conversation-id))
         (position (line-number-at-pos)))
    (when id
      (setq egerrit--current-entities
            (thread-last egerrit--current-entities
                         (seq-map (lambda (it)
                                    (when (string= (symbol-name id) (egerrit--conversation-id it))
                                      (let ((status (egerrit--conversation-status it)))
                                        (setf (egerrit--conversation-status it)
                                              (if (eq 'unresolved status)
                                                  'resolved
                                                'unresolved))))
                                    it))))
      (egerrit--generate-comments-buffer egerrit--current-entities)
      (goto-char (point-min))
      (forward-line (1- position))
      (egerrit-focus-on-conversation)
      (recenter))))

;;;; Support functions

(defun egerrit--goto-to-conversation (conversation-id)
  "Move to conversation with CONVERSATION-ID."
  (goto-char (point-min))
  (if-let* ((at-location (eq conversation-id (plist-get (text-properties-at (point)) 'conversation-id)))
            (comments-start
             (text-property-search-forward 'comments t t)))
      (goto-char (prop-match-beginning comments-start))
    (when-let* ((conversation-location
                 (text-property-search-forward 'conversation-id conversation-id (lambda (value current-value) (eq value current-value))))
                (comments-start
                 (progn
                   (goto-char (prop-match-beginning conversation-location))
                   (text-property-search-forward 'comments t t))))
      (goto-char (prop-match-beginning comments-start))))
  (egerrit-focus-on-conversation))

(defun egerrit--diff-locate-conversation-hunk (conversation)
  "Locate the hunk that the CONVERSATION and return data."
  (let ((side (egerrit--conversation-side conversation))
        (commit-message-hunk (string= "/COMMIT_MSG" (egerrit--conversation-file conversation)))
        (gerrit-commit-message-offset 7))
    (goto-char (point-min))
    (if commit-message-hunk
        (progn
          (search-forward "Subject: [PATCH] ")
          `(,gerrit-commit-message-offset
            ,(save-excursion (diff-hunk-next) (line-number-at-pos))))

      ;; 1) Find the boundaries of the file of interest
      (let ((file-regexp
             (if (eq side 'revision)
                 (format "+++ b/%s" (egerrit--conversation-file conversation))
               (format "--- a/%s" (egerrit--conversation-file conversation)))))

        ;; Conversations from a previous patch set are not always found in the diff
        (if (search-forward-regexp file-regexp nil t)
            (pcase-let ((`(,file-start ,file-end) (diff-bounds-of-file))
                        (location)
                        (conversation-line (egerrit--range-start-line
                                            (egerrit--conversation-range conversation))))
              ;; 2) Find the hunk that best matches the range described in
              ;; the conversation
              (goto-char (1- file-end))
              (setq location `(,(egerrit--diff-hunk-line-offset side)
                               ,(save-excursion
                                  (goto-char (1- (diff-end-of-hunk)))
                                  (line-number-at-pos))))

              (save-excursion
                (while (and (<= file-start (point))
                            (<= conversation-line (egerrit--diff-hunk-line-offset side))
                            (not (eobp)))
                  (diff-hunk-prev)
                  (goto-char (1- (point)))
                  (setq location `(,(egerrit--diff-hunk-line-offset side)
                                   ,(line-number-at-pos)))))

              ;; 3) Return the location info
              (diff-beginning-of-hunk)
              location)
          ;; File can not be found
          '(0 0))))))
(defun egerrit--diff-locate-conversation (conversation)
  "Locate a CONVERSATION in the diff buffer."
  (let* ((side (egerrit--conversation-side conversation))
         (range (egerrit--conversation-range conversation))
         ;; TODO(Niklas Eklund, 20220405): Ideally file-level-comment
         ;; should locate the correct file, but now we will end up at
         ;; the top of the diff buffer. This is something to improve
         ;; in the future
         (file-level-comment (null (egerrit--range-start-line range)))
         (commit-message-hunk (string= "/COMMIT_MSG" (egerrit--conversation-file conversation)))
         (patchset-level (string= "/PATCHSET_LEVEL" (egerrit--conversation-file conversation)))
         (found-it))
    (save-excursion
      (if (or patchset-level file-level-comment)
          `(0 0)
        (if-let ((location (egerrit--diff-locate-conversation-hunk conversation)))
            ;; Move to the correct line
            (save-excursion
              (pcase-let ((`(,line ,hunk-end-line) location))
                (while
                    (and
                     (< (line-number-at-pos) hunk-end-line)
                     (not found-it)
                     (not (eobp)))
                  (forward-line 1)
                  (unless (string-prefix-p (if (eq side 'revision) "-" "+") (thing-at-point 'line))
                    (setq line (1+ line)))
                  (when (= line (egerrit--range-start-line range))
                    (setq found-it t)))
                ;; Move to the correct column if comment is found inside the hunk
                (when found-it
                  (if-let ((start-char (egerrit--range-start-character range)))
                      (move-to-column (+ (if commit-message-hunk 0 1)
                                         start-char))
                    (beginning-of-line))))
              ;; Return point as region
              `(,(point) ,(point)))
          `(0 0))))))

(defun egerrit--create-conversations (file-conversations)
  "Create `egerrit-conversation' objects from FILE-CONVERSATIONS."
  (pcase-let* ((`(,file-name . ,conversations) file-conversations))
    (seq-map (lambda (it)
               (let ((first-comment (seq-first it))
                     (last-comment (seq-first (seq-reverse it))))
                 (let-alist first-comment
                   (egerrit--conversation-create
                    :id (alist-get 'id last-comment)
                    :file (symbol-name file-name)
                    :context-lines .context_lines
                    :comments (egerrit--create-conversation-comments it)
                    :patch-set .patch_set
                    :range (if .range
                               (egerrit--create-range .range)
                             (egerrit--range-create :start-line .line
                                                    :end-line .line))
                    :side (if .side 'parent 'revision)
                    :status (if (alist-get 'unresolved last-comment) 'unresolved 'resolved)))))
             conversations)))

(defun egerrit--get-conversations (change revision)
  "Return comments from CHANGE based on REVISION.

Return comments that are unresolved and are either created on revision
or previous revisions."
  (let* ((revision-number (egerrit--revision-number revision))
         (conversations
          (thread-last (egerrit--change-conversations change)
                       (seq-remove (lambda (it) (> (egerrit--conversation-patch-set it) revision-number)))
                       (seq-filter (lambda (it) (eq 'unresolved (egerrit--conversation-status it))))
                       (seq-map #'egerrit--generate-conversation-context))))
    conversations))

(defun egerrit--generate-conversation-context (conversation)
  "Update CONVERSATION with a context."
  (if (egerrit--conversation-context conversation)
      ;; No need to regenerate context
      conversation
    (if (not (egerrit--conversation-context-lines conversation))
        ;; No context-lines, no context
        nil
      (let* ((file (egerrit--conversation-file conversation))
             (range (egerrit--conversation-range conversation))
             (context-lines (egerrit--conversation-context-lines conversation))
             (context  (string-join
                        (seq-map (lambda (it) (alist-get 'context_line it)) context-lines)
                        "\n"))
             (start-line-offset)
             (end-line-offset)
             (start)
             (conversation-context))
        (if (string-empty-p context)
            conversation
          (setq start-line-offset (- (egerrit--range-start-line range)
                                     (let-alist (seq-first context-lines) .line_number)))
          (with-temp-buffer
            (insert context)
            (goto-char (point-min))
            (forward-line start-line-offset)
            (if-let ((start-char (egerrit--range-start-character range)))
                (move-to-column start-char)
              (beginning-of-line))
            (setq start (point))
            (setq end-line-offset (- (egerrit--range-end-line range)
                                     (let-alist (seq-first (seq-reverse context-lines)) .line_number)))
            (goto-char (point-max))
            (forward-line end-line-offset)
            (if-let ((end-char (egerrit--range-end-character range)))
                (move-to-column end-char)
              (end-of-line))
            (when-let* ((no-commit-message (not (string= "/COMMIT_MSG" file)))
                        (extension (file-name-extension file t))
                        (mode (thread-last auto-mode-alist
                                           (seq-find (lambda (it)
                                                       (string-match-p (car it) extension)))
                                           (cdr))))
              (funcall mode)
              ;; We ignore errors since the context is not guaranteed to be complete
              (ignore-errors
                (font-lock-ensure)))
            ;; Add text properties to the whole region
            (remove-text-properties (point-min) (point-max) '(font-lock-face fontified))
            (font-lock-append-text-property (point-min) (point-max) 'face 'egerrit-context-background-face)

            ;; Add a text property to highlight region
            (add-text-properties start (point) '(face egerrit-context-highlight-face))

            (setq conversation-context (buffer-string))
            (setf (egerrit--conversation-context conversation) conversation-context)
            conversation))))))

(defun egerrit--create-conversation-comments (json-comments)
  "Convert the list of JSON-COMMENTS to an alist."
  (seq-map
   (lambda (it)
     (let-alist it
       `(,.author.name . ,.message)))
   json-comments))

(defun egerrit--remove-blocked-comments (file-comments)
  "Remove blocked comments from FILE-COMMENTS."
  (pcase-let* ((`(,file-name . ,comments) file-comments)
               (filtered-comments))

    ;; Filter out blocked comments
    (setq filtered-comments
          (seq-remove (lambda (it)
                        (seq-find (lambda (message-regexp)
                                    (string-match message-regexp (alist-get 'message it)))
                                  egerrit-comment-block-list))
                      comments))
    `(,file-name . ,filtered-comments)))

(defun egerrit--group-conversation-comments (file-comments)
  "Group FILE-COMMENTS."
  (pcase-let* ((`(,file-name . ,comments) file-comments)
               ;; Find all comments that start conversations
               (conversation-starters
                (seq-remove (lambda (it)
                              (alist-get 'in_reply_to it))
                            comments))
               (conversations)
               (clustered-comments))

    ;; For each conversation starter find the related comments
    (setq clustered-comments
          (seq-map (lambda (it)
                     (egerrit--cluster-comments it comments))
                   conversation-starters))

    (setq conversations
          (thread-last clustered-comments
                       (nreverse)
                       (vconcat)))

    `(,file-name . ,conversations)))

(defun egerrit--cluster-comments (start-comment comments)
  "Cluster all COMMENTS which relates to START-COMMENT."
  (let* ((conversation-comments `(,start-comment))
         (id (alist-get 'id start-comment))
         (replies
          (seq-filter (lambda (it)
                        (string= (alist-get 'in_reply_to it) id))
                      comments)))

    ;; Iterate all comments until there is no reply
    (dolist (reply replies) conversation-comments
            (setq conversation-comments
                  `(,@conversation-comments
                    ,@(egerrit--cluster-comments reply comments))))
    conversation-comments))

(defun egerrit--generate-comments-str (conversation)
  "Generate a string representation of CONVERSATION's comments."
  (let ((comments-str
         (string-join
          (seq-map (lambda (it)
                     (let ((fill-column 100))
                       (with-temp-buffer
                         (insert (format "%s:\n %s\n" (car it) (cdr it)))
                         (funcall egerrit-comment-formatter)
                         (buffer-string))))
                   (egerrit--conversation-comments conversation))
          "")))
    (put-text-property 0 (length comments-str) 'comments t comments-str)
    comments-str))

(defun egerrit--generate-status-str (conversation)
  "Generate a string representation of CONVERSATION's status."
  (let ((status-value-str
         (if (eq 'unresolved (egerrit--conversation-status conversation))
             "TODO"
           "DONE"))
        (status-property-str "Status"))
    (setq status-value-str
          (with-temp-buffer
            (insert status-value-str)
            (funcall egerrit-status-formatter)
            (buffer-string)))
    (put-text-property 0 (length status-property-str) 'face 'egerrit-unknown-face status-property-str)
    (format "%s: %s\n" status-property-str status-value-str)))

(defun egerrit--conversation-str (conversation)
  "Return a string representation of CONVERSATION."
  (let* ((id (intern (egerrit--conversation-id conversation)))
         (file-str (egerrit--conversation-file-str conversation))
         (status-str (egerrit--generate-status-str conversation))
         (comments-str (egerrit--generate-comments-str conversation))
         (patch-set-str (egerrit--conversation-patch-set-str conversation))
         (context-start-line "src\n")
         (context-end-line "src\n")
         (context-str)
         (conversation-str))

    (put-text-property 0 (length context-start-line) 'face 'egerrit-context-block-begin-face context-start-line)
    (put-text-property 0 (length context-end-line) 'face 'egerrit-context-block-end-face context-end-line)

    (setq context-str
          (when-let ((context (egerrit--conversation-context conversation)))
            (format "%s%s\n%s\n"
                    context-start-line
                    context
                    context-end-line)))

    (setq conversation-str
          (string-join
           (seq-remove #'null
                       `(,file-str
                         ,status-str
                         ,patch-set-str
                         "\n"
                         ,context-str
                         ,comments-str))
           ""))

    (put-text-property 0 (length conversation-str) 'conversation-id id conversation-str)
    (put-text-property 0 (length conversation-str) 'conversation t conversation-str)

    conversation-str))

(defun egerrit--conversations-str (conversations)
  "Return a string representation of CONVERSATIONS."
  (string-join
   (thread-last conversations
                (seq-map
                 (lambda (it)
                   `(,(egerrit--conversation-str it) ; conversation
                     ,(format "") ; line-break
                     )))
                (flatten-list)
                (butlast))
   "\n"))

(defun egerrit--conversation-patch-set-str (conversation)
  "Generate a string representation of CONVERSATION's patch-set."
  (let ((patch-set-str (format "Patch-set: %s\n" (egerrit--conversation-patch-set conversation))))
    (put-text-property 0 (length patch-set-str) 'face 'egerrit-unknown-face patch-set-str)
    patch-set-str))

(defun egerrit--conversation-file-str (conversation)
  "Generate a string representation of CONVERSATION's file."
  (let ((file-name (egerrit--conversation-file conversation))
        (side-str
         (if-let ((side (egerrit--conversation-side conversation)))
             (if (eq 'parent side)
                 "--- "
               "+++ ")
           "??? "))
        (file-str))
    (setq file-str
          (format "%s%s\n" side-str file-name))
    (put-text-property 0 (length file-str) 'face 'egerrit-file-name-face file-str)
    file-str))

;;;; Major mode

(define-derived-mode egerrit-conversation-mode fundamental-mode "Egerrit Conversation"
  "Mode for `egerrit' conversations."
  (add-hook 'post-command-hook #'egerrit-focus-on-conversation nil t))

(let ((map egerrit-conversation-mode-map))
  (define-key map (kbd "<return>") #'egerrit-visit-conversation)
  (define-key map (kbd "S-<return>") #'egerrit-visit-conversation-source-code)
  (define-key map (kbd "M-n") #'egerrit-next-conversation)
  (define-key map (kbd "M-p") #'egerrit-previous-conversation)
  (define-key map (kbd "C-c '") #'egerrit-create-comment)
  (define-key map (kbd "C-c C-k") #'egerrit-kill-comment)
  (define-key map (kbd "C-c C-i") #'egerrit-open-info)
  (define-key map (kbd "C-c C-q") #'egerrit-quit-review-or-feedback)
  (define-key map (kbd "C-c C-y") #'egerrit-yank-url)
  (define-key map (kbd "C-c C-t") #'egerrit-toggle-conversation-status)
  (define-key map (kbd "C-c C-r") #'egerrit-publish-review-label)
  (define-key map (kbd "C-c C-p") #'egerrit-publish-draft-comments)
  (define-key map (kbd "C-c C-s") #'egerrit-publish-comments))

(provide 'egerrit-conversation)

;;; egerrit-conversation.el ends here