all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Diff Mode: Can I apply a difference to a buffer of my choosing?
Date: Sat, 04 Feb 2006 17:35:55 -0500	[thread overview]
Message-ID: <8764nulpvd.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: ielird.jl.ln@acm.acm

> .  I have loaded cc-defs.el.diff into a buffer in Diff Mode.  I want to
> apply one of its diffs to a buffer (coincidentally also called
> cc-defs.el).  However, when I try C-c C-a (`diff-apply-hunk'), Emacs
> loads a different version of cc-defs.el, and applies the patch to that.

diff-mode basically looks at the diff's header (or "Index:" line) to find
the file name to which the patch should be applied, then does find-file on
that file to get the buffer.

So you can try to get what you want, by doing a M-x cd in the diff's buffer
before C-s C-a (presumaing the diff's header uses relative path names).

> Is there any convenient way of associating cc-defs.el.diff with the
> buffer I want to change?

In Emacs-CVS, I've added a command diff-tell-file-name to do just that (tho
it still doesn't allow you to bind to a buffer, only to a filename).

In previous versions, you can do is M-x cd RET /some/where/else since if
diff-mode can't find the file on its own, it then asks you to enter the
destination file name interactively.


        Stefan

  reply	other threads:[~2006-02-04 22:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-29 15:02 Diff Mode: Can I apply a difference to a buffer of my choosing? Alan Mackenzie
2006-02-04 22:35 ` Stefan Monnier [this message]
2006-02-10 11:11   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764nulpvd.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.