<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Dealing with mercurial patch queue rejects in emacs</title>
	<atom:link href="http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/</link>
	<description>/* You are not expected to understand this */</description>
	<lastBuildDate>Sat, 04 Feb 2012 03:50:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jim Blandy</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-16489</link>
		<dc:creator>Jim Blandy</dc:creator>
		<pubDate>Fri, 27 Jan 2012 17:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-16489</guid>
		<description>This behaved surprisingly for me when I switched to a file I was sure I was visiting with C-x b, and then hit C-c r: I wasn&#039;t actually visiting the file, and switch-hg-reject wasn&#039;t prepared for a buffer in which buffer-file-name returns nil.

Also, if you run this in a buffer whose filename is less than four characters long, I think there might be problems.

If the file being switched to doesn&#039;t exist, then that should be an error, not just  a message; errors abort keyboard macros and have other useful behaviors.

Finally, I think it&#039;s nice to check for errors with &#039;unless&#039;, so that the post-error-check code isn&#039;t indented.

Here&#039;s my current version:

(defun switch-hg-reject ()
  (interactive)
  (unless (buffer-file-name)
    (error &quot;Buffer is not visiting any file&quot;))
  (let ((other-file
         (if (string-match &quot;\\.rej$&quot; (buffer-file-name))
             (substring (buffer-file-name) 0 (match-beginning 0))
           (concat (buffer-file-name) &quot;.rej&quot;))))    
    (unless (file-exists-p other-file)
      (error &quot;Reject/original file not found: %s&quot; other-file))
    (find-file other-file)))</description>
		<content:encoded><![CDATA[<p>This behaved surprisingly for me when I switched to a file I was sure I was visiting with C-x b, and then hit C-c r: I wasn&#8217;t actually visiting the file, and switch-hg-reject wasn&#8217;t prepared for a buffer in which buffer-file-name returns nil.</p>
<p>Also, if you run this in a buffer whose filename is less than four characters long, I think there might be problems.</p>
<p>If the file being switched to doesn&#8217;t exist, then that should be an error, not just  a message; errors abort keyboard macros and have other useful behaviors.</p>
<p>Finally, I think it&#8217;s nice to check for errors with &#8216;unless&#8217;, so that the post-error-check code isn&#8217;t indented.</p>
<p>Here&#8217;s my current version:</p>
<p>(defun switch-hg-reject ()<br />
  (interactive)<br />
  (unless (buffer-file-name)<br />
    (error &#8220;Buffer is not visiting any file&#8221;))<br />
  (let ((other-file<br />
         (if (string-match &#8220;\\.rej$&#8221; (buffer-file-name))<br />
             (substring (buffer-file-name) 0 (match-beginning 0))<br />
           (concat (buffer-file-name) &#8220;.rej&#8221;))))<br />
    (unless (file-exists-p other-file)<br />
      (error &#8220;Reject/original file not found: %s&#8221; other-file))<br />
    (find-file other-file)))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Blandy</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-16398</link>
		<dc:creator>Jim Blandy</dc:creator>
		<pubDate>Wed, 25 Jan 2012 17:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-16398</guid>
		<description>Wonderful! It seems like mercurial queues should treat patch rejects like merge conflicts, but short of that, this seems quite helpful.</description>
		<content:encoded><![CDATA[<p>Wonderful! It seems like mercurial queues should treat patch rejects like merge conflicts, but short of that, this seems quite helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravid</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-428</link>
		<dc:creator>Ravid</dc:creator>
		<pubDate>Fri, 09 Apr 2010 06:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-428</guid>
		<description>Je im geschwatzt hufschmied dammerigen wasserkrug mu sa freundlich. Gutes zog neuen nicht des buben. Zusammen es la stabelle verwirrt bi konntest. Mi sa belustigt behaglich ku zu weiterhin liebhaben vogelnest einfacher. Dienstmagd so nachmittag vertreiben jahreszeit he zu er. Eck plaudernd ihn eia schwachen getrunken wohnstube.</description>
		<content:encoded><![CDATA[<p>Je im geschwatzt hufschmied dammerigen wasserkrug mu sa freundlich. Gutes zog neuen nicht des buben. Zusammen es la stabelle verwirrt bi konntest. Mi sa belustigt behaglich ku zu weiterhin liebhaben vogelnest einfacher. Dienstmagd so nachmittag vertreiben jahreszeit he zu er. Eck plaudernd ihn eia schwachen getrunken wohnstube.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Matthews</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-285</link>
		<dc:creator>Josh Matthews</dc:creator>
		<pubDate>Wed, 03 Mar 2010 19:34:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-285</guid>
		<description>Ted: KDiff3 comes up automatically when rebasing for me, but I didn&#039;t realize that you could make hg use it for rejects as well.  Interesting.</description>
		<content:encoded><![CDATA[<p>Ted: KDiff3 comes up automatically when rebasing for me, but I didn&#8217;t realize that you could make hg use it for rejects as well.  Interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted Mielczarek</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-284</link>
		<dc:creator>Ted Mielczarek</dc:creator>
		<pubDate>Wed, 03 Mar 2010 16:51:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-284</guid>
		<description>Personally I have configured KDiff3, and I find that much preferable to hand-editing rejects. (I&#039;m an emacs user as well, but not religious about it.)</description>
		<content:encoded><![CDATA[<p>Personally I have configured KDiff3, and I find that much preferable to hand-editing rejects. (I&#8217;m an emacs user as well, but not religious about it.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Faster mercurial patch queue merging with emacs &#124; Dysfunctional Programming</title>
		<link>http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/comment-page-1/#comment-277</link>
		<dc:creator>Faster mercurial patch queue merging with emacs &#124; Dysfunctional Programming</dc:creator>
		<pubDate>Tue, 02 Mar 2010 01:41:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshmatthews.net/blog/2010/01/dealing-with-mercurial-patch-queue-rejects-in-emacs/#comment-277</guid>
		<description>[...] a follow-up to my previous post about merging mq reject in emacs, I thought I&#8217;d share some improvements to the process that [...]</description>
		<content:encoded><![CDATA[<p>[...] a follow-up to my previous post about merging mq reject in emacs, I thought I&#8217;d share some improvements to the process that [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

