From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60338: [PATCH] Add option to present server changes as diffs Date: Mon, 12 Jun 2023 14:56:30 +0300 Message-ID: <83jzw8yjv5.fsf@gnu.org> References: <87ilhy1dub.fsf@posteo.net> <877cs97kgb.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4090"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60338@debbugs.gnu.org, joaotavora@gmail.com To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 12 13:57:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q8gAj-0000vT-R0 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Jun 2023 13:57:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q8gAR-0008Pc-Tl; Mon, 12 Jun 2023 07:57:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8gAQ-0008PH-Je for bug-gnu-emacs@gnu.org; Mon, 12 Jun 2023 07:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q8gAQ-0002Lx-7K for bug-gnu-emacs@gnu.org; Mon, 12 Jun 2023 07:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q8gAP-0000Ox-Si for bug-gnu-emacs@gnu.org; Mon, 12 Jun 2023 07:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jun 2023 11:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60338 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60338-submit@debbugs.gnu.org id=B60338.16865709851490 (code B ref 60338); Mon, 12 Jun 2023 11:57:01 +0000 Original-Received: (at 60338) by debbugs.gnu.org; 12 Jun 2023 11:56:25 +0000 Original-Received: from localhost ([127.0.0.1]:39120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8g9o-0000Nx-Lx for submit@debbugs.gnu.org; Mon, 12 Jun 2023 07:56:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8g9m-0000Nj-6C for 60338@debbugs.gnu.org; Mon, 12 Jun 2023 07:56:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8g9f-0002G6-Nl; Mon, 12 Jun 2023 07:56:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Jzd/ACu1UV7G37ETS6pjGg4j1N6c3AeFy4ebv5oeA5E=; b=RiU6UwvKRQ8c JaZbEXKljzOIJfq232OyvI00zF3yO6ZPMLfUmCdsd9rcwnWC31T8g3L7nh4V55+o0Uc+xb1tmxbyN XirmeH/5vJOzhwNRjRLxhdX4pCvt3YgpJ8Q4cud9dXMlh2T7TpS8934qsD6sgQzJZq4m5y80on7hz LJ7ccikSYU+h2EBHBpZQlAgPrFTbArnpnt+Q/DNWBl89de93ExUpYOLkJJ/IRuG14oCA953QyQ+2k 58ZfJMCrrCN3cBr7ER/lbsEl2+koFR4aM4PE4km75dLm+QlmOzOuPki1/4AyzIJk3cCCpFXcIGDjg OtdBwXMPXvL+Wsu7E5Hu/g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8g9f-0006MS-7J; Mon, 12 Jun 2023 07:56:15 -0400 In-Reply-To: <877cs97kgb.fsf@posteo.net> (message from Philip Kaludercic on Sun, 11 Jun 2023 21:33:40 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263264 Archived-At: > From: Philip Kaludercic > Date: Sun, 11 Jun 2023 21:33:40 +0000 > > + ((eq confirm 'diff) > + (with-current-buffer (get-buffer-create " *Changes*") > + (buffer-disable-undo (current-buffer)) > + (let ((buffer-read-only t)) > + (diff-mode)) > + (let ((inhibit-read-only t) > + (target (current-buffer))) > + (erase-buffer) > + (pcase-dolist (`(,path ,edits ,_) prepared) > + (with-temp-buffer > + (let ((diff (current-buffer))) > + (with-temp-buffer > + (insert-file-contents path) > + (eglot--apply-text-edits edits) > + (diff-no-select path (current-buffer) > + nil t diff)) Isn't there a better way of presenting the edits in human-readable form than apply them and then run Diff? What format is used by the server itself to send the edits? Besides, this assumes the 'diff' command is available, which is not portable -- one more reason not to go that way, or at leas provide an alternative.