From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Diff Mode: Can I apply a difference to a buffer of my choosing? Date: Fri, 10 Feb 2006 11:11:21 +0000 Organization: muc.de e.V. -- private internet access Message-ID: References: <8764nulpvd.fsf-monnier+gnu.emacs.help@gnu.org> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1139574868 29846 80.91.229.2 (10 Feb 2006 12:34:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2006 12:34:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 10 13:34:26 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F7XTe-0008Ts-8g for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Feb 2006 13:34:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F7XLr-00005J-TG for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Feb 2006 07:26:15 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news-peer.in.tum.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1139572405 73300 193.149.49.134 (10 Feb 2006 11:53:25 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 10 Feb 2006 11:53:25 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:137489 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:33114 Archived-At: Stefan Monnier wrote on Sat, 04 Feb 2006 17:35:55 -0500: >> . 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-c C-a (presumaing the diff's header uses relative path > names). YES, YES, YES!!! Brilliant! Fantastic! That works! Thanks! >> 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). OK. Binding to a buffer would be nice to have, but binding to a file will be good enough nearly all the time. > In previous versions, what 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. Again, thanks! > Stefan -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").