all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Reviewing git patches with the source file without applying the patch
@ 2023-12-05  4:59 husain
  2023-12-08 13:46 ` James Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: husain @ 2023-12-05  4:59 UTC (permalink / raw)
  To: help-gnu-emacs


Hello,

I often receive patches (files generated by 'git format-path'
command). I review these files in diff-mode. This is in most cases is
enough. But sometimes, I want to see the source code before and after
the change so that I can see the full context. I am not sure how to do
this in emacs.

diff-mode provides C-c C-c (which is diff-goto-source). This is great
improvement, but it shows the source file only, not the changes before
and after. I have to compute in my head the patch against the source
file to undrestand the change. Additionally, diff-goto-source requires
the path to the source file. I wish it would take the dir instead and it
can compute the source file on its own.

diff-mode also provides C-c C-e (which is diff-ediff-patch). This view
is what I am looking for: it provides a view when I can see the source
file before and after the change. However, diff-ediff-patch applies the
change automatically, which is not what I want to do. Additionally,
diff-ediff-patch generates .orig files which are also unwant.

Any help is appreciated.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reviewing git patches with the source file without applying the patch
       [not found] <87a5qpb5y6.fsf@>
@ 2023-12-05  7:31 ` mbork
  0 siblings, 0 replies; 3+ messages in thread
From: mbork @ 2023-12-05  7:31 UTC (permalink / raw)
  To: husain; +Cc: help-gnu-emacs


On 2023-12-04, at 22:59, husain@alshehhi.io wrote:

> Hello,
>
> I often receive patches (files generated by 'git format-path'
> command). I review these files in diff-mode. This is in most cases is
> enough. But sometimes, I want to see the source code before and after
> the change so that I can see the full context. I am not sure how to do
> this in emacs.
>
> diff-mode provides C-c C-c (which is diff-goto-source). This is great
> improvement, but it shows the source file only, not the changes before
> and after. I have to compute in my head the patch against the source
> file to undrestand the change. Additionally, diff-goto-source requires
> the path to the source file. I wish it would take the dir instead and it
> can compute the source file on its own.
>
> diff-mode also provides C-c C-e (which is diff-ediff-patch). This view
> is what I am looking for: it provides a view when I can see the source
> file before and after the change. However, diff-ediff-patch applies the
> change automatically, which is not what I want to do. Additionally,
> diff-ediff-patch generates .orig files which are also unwant.
>
> Any help is appreciated.

That is a great question, and I don't have a 100% solution, but I would
probably use Magit, which makes it easy to discard the changes after
(temporarily) applying the patch.

Hth,

-- 
Marcin Borkowski
https://mbork.pl



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reviewing git patches with the source file without applying the patch
  2023-12-05  4:59 husain
@ 2023-12-08 13:46 ` James Thomas
  0 siblings, 0 replies; 3+ messages in thread
From: James Thomas @ 2023-12-08 13:46 UTC (permalink / raw)
  To: husain; +Cc: help-gnu-emacs

husain@alshehhi.io wrote:

> Hello,
>
> I often receive patches (files generated by 'git format-path'
> command). I review these files in diff-mode. This is in most cases is
> enough. But sometimes, I want to see the source code before and after
> the change so that I can see the full context. I am not sure how to do
> this in emacs.
>
> diff-mode provides C-c C-c (which is diff-goto-source). This is great
> improvement, but it shows the source file only, not the changes before
> and after. I have to compute in my head the patch against the source
> file to undrestand the change. Additionally, diff-goto-source requires
> the path to the source file. I wish it would take the dir instead and it
> can compute the source file on its own.
>
> diff-mode also provides C-c C-e (which is diff-ediff-patch). This view
> is what I am looking for: it provides a view when I can see the source
> file before and after the change. However, diff-ediff-patch applies the
> change automatically, which is not what I want to do. Additionally,
> diff-ediff-patch generates .orig files which are also unwant.
>
> Any help is appreciated.

There's ediff-patch-buffer. You can also try diffing the buffer with the
file after applying the patch in diff mode, for eg, with
ediff-current-file. More: (info "(ediff) Major Entry Points")

--



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-08 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87a5qpb5y6.fsf@>
2023-12-05  7:31 ` Reviewing git patches with the source file without applying the patch mbork
2023-12-05  4:59 husain
2023-12-08 13:46 ` James Thomas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.