Skip to content

Commit

Permalink
Fix View Change's Patch Chinese display issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shuxiao9058 committed Oct 6, 2024
1 parent 8a98747 commit 3a3f5b9
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions gerrit-rest.el
Original file line number Diff line number Diff line change
Expand Up @@ -442,25 +442,32 @@ to CHANGENR is not locally cloned."
gerrit-host
gerrit-rest-endpoint-prefix
(format "/changes/%s/revisions/current/patch" changenr))))

(message "Opening patch of %s" changenr)
(setq gerrit-patch-buffer (get-buffer-create "*gerrit-patch*"))

(setq gerrit-patch-buffer (get-buffer-create "*gerrit-patch*"))
(with-current-buffer gerrit-patch-buffer
(let ((inhibit-read-only t))
(let ((inhibit-read-only t)
(body))
(erase-buffer)
(url-insert-file-contents target)
(base64-decode-region (point-min) (point-max))
(delete-trailing-whitespace))
(url-insert-file-contents target)
(base64-decode-region (point-min) (point-max))
(delete-trailing-whitespace)
(setq body (decode-coding-string
(buffer-substring-no-properties (point-min) (point-max))
'utf-8))
(erase-buffer)
(insert body))

(unless buffer-read-only
(read-only-mode t))
(read-only-mode t))
;; using magit-diff-mode would be nice here, but it doesn't work.
(unless (bound-and-true-p diff-mode)
(diff-mode))
(diff-mode))
;; currently [TAB] is bound to diff-hunk-next. Do we want to change it
;; to `outline-cycle'?
;; beginning with emacs 28 set outline-minor-mode-cycle to t.
(outline-minor-mode))

(switch-to-buffer gerrit-patch-buffer)))


Expand Down

0 comments on commit 3a3f5b9

Please sign in to comment.