- (when (get-buffer "*vc-dir*")
- (kill-buffer (get-buffer "*vc-dir*")))
- (let ((trunk (expand-file-name debbugs-gnu-trunk-directory)))
- (if (equal (cl-subseq default-directory 0 (length trunk))
- trunk)
- (vc-dir debbugs-gnu-trunk-directory)
- (vc-dir debbugs-gnu-branch-directory)))
- (goto-char (point-min))
- (while (not (search-forward "edited" nil t))
- (sit-for 0.01))
- (beginning-of-line)
- (while (search-forward "edited" nil t)
- (vc-dir-mark)
- (beginning-of-line))
- (vc-diff nil)
- (vc-next-action nil)
- (log-edit-insert-changelog t)
- (delete-other-windows)
- (split-window)
- (other-window 1)
- (switch-to-buffer "*vc-diff*")
- (other-window 1))
+ (when (get-buffer "*vc-dir*")
+ (kill-buffer (get-buffer "*vc-dir*")))
+ (let ((patch-subject debbugs-gnu-patch-subject))
+ (let ((trunk (expand-file-name debbugs-gnu-trunk-directory)))
+ (if (equal (cl-subseq default-directory 0 (length trunk))
+ trunk)
+ (vc-dir debbugs-gnu-trunk-directory)
+ (vc-dir debbugs-gnu-branch-directory)))
+ (goto-char (point-min))
+ (while (not (search-forward "edited" nil t))
+ (sit-for 0.01))
+ (beginning-of-line)
+ (while (search-forward "edited" nil t)
+ (vc-dir-mark)
+ (beginning-of-line))
+ (vc-diff nil)
+ (vc-next-action nil)
+ (delete-region (point-min) (point-max))
+ (log-edit-insert-changelog t)
+ (delete-other-windows)
+ (split-window)
+ (other-window 1)
+ (switch-to-buffer "*vc-diff*")
+ (other-window 1)
+ (when patch-subject
+ (insert "Summary: "
+ (replace-regexp-in-string "^ *\\[PATCH\\] *" "" patch-subject)
+ "\n"))))
+
+(defun debbugs-gnu-save-cache ()
+ "Save the bugs cache to a file."
+ (interactive)
+ (unless debbugs-cache-data
+ (error "No data to cache"))
+ (unless (file-exists-p "~/.emacs.d/debbugs-cache")
+ (make-directory "~/.emacs.d/debbugs-cache" t))
+ (let ((coding-system-for-write 'utf-8))
+ (with-temp-file "~/.emacs.d/debbugs-cache/list"
+ (prin1 debbugs-cache-data (current-buffer)))))