{"id":45,"date":"2010-01-27T20:13:10","date_gmt":"2010-01-28T00:13:10","guid":{"rendered":"http:\/\/www.joshmatthews.net\/blog\/2010\/01\/dealing-with-mercurial-patch-queue-rejects-in-emacs\/"},"modified":"2010-01-27T20:13:38","modified_gmt":"2010-01-28T00:13:38","slug":"dealing-with-mercurial-patch-queue-rejects-in-emacs","status":"publish","type":"post","link":"https:\/\/www.joshmatthews.net\/blog\/2010\/01\/dealing-with-mercurial-patch-queue-rejects-in-emacs\/","title":{"rendered":"Dealing with mercurial patch queue rejects in emacs"},"content":{"rendered":"<p>Since Mozilla has embraced mercurial, and especially <a href=\"https:\/\/developer.mozilla.org\/en\/Mercurial_Queues\">patch queues<\/a>, with open arms, I get to deal with rebasing patches frequently.  There are two ways this can happen &#8211; either you set up an external merge tool like meld to handle each conflict, or the rejected changes are dumped in a filename.ext.rej in the same directory as the file being patched.  Since I do all of my work in emacs, I&#8217;ve finally got around to writing an elisp function to allow me to switch to a reject file from the original quickly and painlessly:<\/p>\n<pre lang=\"lisp\">(defun switch-hg-reject ()\r\n  (interactive)\r\n  (let ((other-file\r\n\t (if (string= (substring (buffer-file-name) -4 nil) \".rej\")\r\n\t     (substring (buffer-file-name) 0 -4)\r\n\t   (concat (buffer-file-name) \".rej\"))))    \r\n    (if (file-exists-p other-file)\r\n\t  (switch-to-buffer (find-file-noselect other-file))\r\n      (message (format \"No alternate reject file found\" other-file)))))\r\n\r\n(global-set-key (kbd \"C-c r\") 'switch-hg-reject)<\/pre>\n<p>A simple <code>C-c r<\/code> is all it takes to switch from nsFrameLoader.cpp to nsFrameLoader.cpp.rej in the current buffer, and another <code>C-c r<\/code> will take me back to the original.  Now that&#8217;s convenience!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since Mozilla has embraced mercurial, and especially patch queues, with open arms, I get to deal with rebasing patches frequently. There are two ways this can happen &#8211; either you set up an external merge tool like meld to handle &hellip; <a href=\"https:\/\/www.joshmatthews.net\/blog\/2010\/01\/dealing-with-mercurial-patch-queue-rejects-in-emacs\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,17,15],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-code","category-emacs","category-mozilla"],"_links":{"self":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":1,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}